Skip to content

Documentation


Documentation / @blazetrails/activesupport / OrderedOptions

Class: OrderedOptions ​

Defined in: packages/activesupport/lib/ordered-options.ts:8

Extended by ​

Constructors ​

Constructor ​

new OrderedOptions(defaultBlock?): OrderedOptions

Defined in: packages/activesupport/lib/ordered-options.ts:15

Parameters ​

ParameterType
defaultBlock?(key) => unknown

Returns ​

OrderedOptions

Properties ​

defaultBlock? ​

protected optional defaultBlock?: (key) => unknown

Defined in: packages/activesupport/lib/ordered-options.ts:13

Parameters ​

ParameterType
keystring

Returns ​

unknown


name ​

static name: string = "ActiveSupport::OrderedOptions"

Defined in: packages/activesupport/lib/ordered-options.ts:9

Accessors ​

count ​

Get Signature ​

get count(): number

Defined in: packages/activesupport/lib/ordered-options.ts:168

Returns ​

number


size ​

Get Signature ​

get size(): number

Defined in: packages/activesupport/lib/ordered-options.ts:164

Returns ​

number

Methods ​

_get() ​

protected _get(key): unknown

Defined in: packages/activesupport/lib/ordered-options.ts:20

Parameters ​

ParameterType
keystring

Returns ​

unknown


clear() ​

clear(): this

Defined in: packages/activesupport/lib/ordered-options.ts:127

Returns ​

this


delete() ​

delete(key): unknown

Defined in: packages/activesupport/lib/ordered-options.ts:121

Parameters ​

ParameterType
keystring

Returns ​

unknown


dig() ​

dig(key, ...identifiers): unknown

Defined in: packages/activesupport/lib/ordered-options.ts:47

Mirrors dig (ordered_options.rb:45-47), whose super is rb_hash_dig (vendor/ruby/v3.3.11/hash.c:4627): rb_hash_aref for the first key — which is get, so the default block runs — and rb_obj_dig (vendor/ruby/v3.3.11/object.c:3906) for the rest. That loop ends on nil, indexes a Hash through rb_hash_aref and an Array through rb_ary_at — whose index goes through NUM2LONG (vendor/ruby/v3.3.11/array.c:1881-1883), so a String identifier is a TypeError there and not an index — hands the remaining identifiers to an object that answers dig, and otherwise raises no_dig_method's TypeError (object.c:3897-3900). A Ruby Hash is a plain object or a Map in trails, so both take the rb_hash_aref arm.

Parameters ​

ParameterType
keystring
...identifiers(string | number)[]

Returns ​

unknown


dup() ​

dup(): this

Defined in: packages/activesupport/lib/ordered-options.ts:172

Returns ​

this


each() ​

each(fn): this

Defined in: packages/activesupport/lib/ordered-options.ts:159

Parameters ​

ParameterType
fn(key, value) => void

Returns ​

this


entries() ​

entries(): [string, unknown][]

Defined in: packages/activesupport/lib/ordered-options.ts:140

Returns ​

[string, unknown][]


equals() ​

equals(other): boolean

Defined in: packages/activesupport/lib/ordered-options.ts:155

Parameters ​

ParameterType
otherunknown

Returns ​

boolean


fetch() ​

fetch(key, ...rest): unknown

Defined in: packages/activesupport/lib/ordered-options.ts:86

Hash#fetch (vendor/ruby/v3.3.11/hash.c:2176), which OrderedOptions < Hash (ordered_options.rb:32) inherits: the stored value, else the block's or the default's, else KeyError. The default block is not consulted. []= stores key.to_sym (ordered_options.rb:37-43), so data holds each key in its Symbol form and a miss inspects as :name.

Parameters ​

ParameterType
keystring
...rest[] | [unknown]

Returns ​

unknown


get() ​

get(key): unknown

Defined in: packages/activesupport/lib/ordered-options.ts:30

Parameters ​

ParameterType
keystring

Returns ​

unknown


inspect() ​

inspect(): string

Defined in: packages/activesupport/lib/ordered-options.ts:98

Returns ​

string


isExtractableOptions() ​

isExtractableOptions(): boolean

Defined in: packages/activesupport/lib/ordered-options.ts:94

Returns ​

boolean


isKey() ​

isKey(key): boolean

Defined in: packages/activesupport/lib/ordered-options.ts:107

Parameters ​

ParameterType
keystring

Returns ​

boolean


key() ​

key(value): string | undefined

Defined in: packages/activesupport/lib/ordered-options.ts:111

Parameters ​

ParameterType
valueunknown

Returns ​

string | undefined


keys() ​

keys(): string[]

Defined in: packages/activesupport/lib/ordered-options.ts:132

Returns ​

string[]


respondToMissing() ​

respondToMissing(name, includePrivate): boolean

Defined in: packages/activesupport/lib/ordered-options.ts:90

Parameters ​

ParameterType
namestring
includePrivateboolean

Returns ​

boolean


set() ​

set(key, value): this

Defined in: packages/activesupport/lib/ordered-options.ts:25

Parameters ​

ParameterType
keystring
valueunknown

Returns ​

this


toH() ​

toH(): Record<string, unknown>

Defined in: packages/activesupport/lib/ordered-options.ts:146

Returns ​

Record<string, unknown>


toHash() ​

toHash(): this

Defined in: packages/activesupport/lib/ordered-options.ts:151

Returns ​

this

No Rails Equivalent ​

PERMANENT


toString() ​

toString(): string

Defined in: packages/activesupport/lib/ordered-options.ts:102

Returns ​

string


update() ​

update(otherHash): this

Defined in: packages/activesupport/lib/ordered-options.ts:116

Parameters ​

ParameterType
otherHashRecord<string, unknown>

Returns ​

this


values() ​

values(): unknown[]

Defined in: packages/activesupport/lib/ordered-options.ts:136

Returns ​

unknown[]