Documentation / @blazetrails/activesupport / HashWithIndifferentAccess
Class: HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:31
Extends
Hash<string,V>
Type Parameters
| Type Parameter | Default type |
|---|---|
V | unknown |
Constructors
Constructor
new HashWithIndifferentAccess<
V>(constructor?):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:32
Parameters
| Parameter | Type |
|---|---|
constructor? | AnyObject | Hash<string, V> | NoInfer<V> | DefaultProc<string, V> |
Returns
HashWithIndifferentAccess<V>
Overrides
Hash<string, V>.constructor
Properties
[toStringTag]
readonly[toStringTag]:string
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:135
Inherited from
Hash.[toStringTag]
size
readonlysize:number
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.collection.d.ts:46
Returns
the number of elements in the Map.
Inherited from
Hash.size
[species]
readonlystatic[species]:MapConstructor
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:317
Inherited from
Hash.[species]
Methods
[iterator]()
[iterator]():
Generator<[string,V],undefined,unknown>
Defined in: packages/ruby-compat/dist/hash.d.ts:677
rb_hash_foreach (vendor/ruby/v3.3.11/hash.c:1438), the walk every yielding Hash method goes through: it raises the receiver's iter_lev for the length of the walk and lowers it in an ensure. A for…of that ends, breaks or throws closes the iterator and lowers the level. One left part-way keeps it raised, as a suspended hash.each Enumerator does.
Returns
Generator<[string, V], undefined, unknown>
No Rails Equivalent
PERMANENT — Ruby core rb_hash_foreach (vendor/ruby/v3.3.11/hash.c:1438).
Inherited from
Hash.[iterator]
all()
all(
fn?):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:433
Parameters
| Parameter | Type |
|---|---|
fn? | (pair) => boolean |
Returns
boolean
any()
any(
fn?):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:425
Parameters
| Parameter | Type |
|---|---|
fn? | (pair) => boolean |
Returns
boolean
assoc()
assoc(
key): [string,V] |null
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:477
Hash#assoc (vendor/ruby/v3.3.11/hash.c:4193 rb_hash_assoc): the stored key and its value for key, else nil.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
[string, V] | null
No Rails Equivalent
PERMANENT
Overrides
Hash.assoc
clear()
clear():
void
Defined in: packages/ruby-compat/dist/hash.d.ts:568
Hash#clear (vendor/ruby/v3.3.11/hash.c:1988 rb_hash_clear), which also begins with rb_hash_modify_check.
Returns
void
No Rails Equivalent
PERMANENT — Ruby core Hash#clear (vendor/ruby/v3.3.11/hash.c:1988).
Inherited from
Hash.clear
compact()
compact():
HashWithIndifferentAccess<NonNullable<V>>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:393
Hash#compact (vendor/ruby/v3.3.11/hash.c:4360 rb_hash_compact): a dup with every nil value dropped (delete_if_nil).
Returns
HashWithIndifferentAccess<NonNullable<V>>
No Rails Equivalent
PERMANENT
Overrides
Hash.compact
compactBang()
compactBang():
HashWithIndifferentAccess<V> |null
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:399
Hash#compact! (vendor/ruby/v3.3.11/hash.c:4385 rb_hash_compact_bang).
Returns
HashWithIndifferentAccess<V> | null
No Rails Equivalent
PERMANENT
Overrides
Hash.compactBang
compareByIdentity()
compareByIdentity():
this
Defined in: packages/ruby-compat/dist/hash.d.ts:667
Hash#compare_by_identity (vendor/ruby/v3.3.11/hash.c:4427rb_hash_compare_by_id): keys are compared by identity from here on, and the receiver is returned. The rehash into an identhash table keeps every entry, since two stored keys were never eql?, so only the eql? index goes. A JS string is a primitive with no identity apart from its value, so two equal Strings stay one key where Ruby makes them two.
Returns
this
No Rails Equivalent
PERMANENT — Ruby core Hash#compare_by_identity (vendor/ruby/v3.3.11/hash.c:4427).
Inherited from
Hash.compareByIdentity
count()
count(
fn?):number
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:446
Parameters
| Parameter | Type |
|---|---|
fn? | (pair) => boolean |
Returns
number
deconstructKeys()
deconstructKeys(
_keys):this
Defined in: packages/ruby-compat/dist/hash.d.ts:964
Hash#deconstruct_keys (vendor/ruby/v3.3.11/hash.c:4759rb_hash_deconstruct_keys): the receiver itself.
Parameters
| Parameter | Type |
|---|---|
_keys | unknown |
Returns
this
No Rails Equivalent
PERMANENT
Inherited from
Hash.deconstructKeys
deepMerge()
deepMerge(
other,block?):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:239
Parameters
| Parameter | Type |
|---|---|
other | AnyObject | HashWithIndifferentAccess<V> |
block? | BlockFn<V> |
Returns
HashWithIndifferentAccess<V>
deepMergeBang()
deepMergeBang(
other,block?):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:246
Parameters
| Parameter | Type |
|---|---|
other | AnyObject | HashWithIndifferentAccess<V> |
block? | BlockFn<V> |
Returns
this
deepStringifyKeys()
deepStringifyKeys():
HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:417
Returns
HashWithIndifferentAccess<V>
deepStringifyKeysBang()
deepStringifyKeysBang():
this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:421
Returns
this
deepSymbolizeKeys()
deepSymbolizeKeys():
AnyObject|Hash<string,unknown>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:555
Returns
AnyObject | Hash<string, unknown>
deepTransformKeys()
deepTransformKeys(
block):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:409
Parameters
| Parameter | Type |
|---|---|
block | (key) => string |
Returns
HashWithIndifferentAccess<V>
deepTransformKeysBang()
deepTransformKeysBang(
block):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:413
Parameters
| Parameter | Type |
|---|---|
block | (key) => string |
Returns
this
default()
default(...
key):V|undefined
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:92
Hash#default (vendor/ruby/v3.3.11/hash.c:2238 rb_hash_default), both arms: with no argument the stored default value — nil when a default_proc is what is stored — and with a key the proc's result for that key.
Parameters
| Parameter | Type |
|---|---|
...key | [] | [string] |
Returns
V | undefined
No Rails Equivalent
PERMANENT — Ruby core Hash#default (vendor/ruby/v3.3.11/hash.c:2238).
Overrides
Hash.default
defaultProc()
defaultProc():
DefaultProc<string,V> |undefined
Defined in: packages/ruby-compat/dist/hash.d.ts:615
Hash#default_proc (vendor/ruby/v3.3.11/hash.c:2285 rb_hash_default_proc): the proc only when one is what is stored.
Returns
DefaultProc<string, V> | undefined
No Rails Equivalent
PERMANENT — Ruby core Hash#default_proc (vendor/ruby/v3.3.11/hash.c:2285).
Inherited from
Hash.defaultProc
delete()
delete(
key,block?):any
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:120
Hash#delete (vendor/ruby/v3.3.11/hash.c:2441 rb_hash_delete_m): returns the deleted value, the block's result for a key that was not there, nil otherwise. Map#delete returns a boolean instead, and a TS override may not narrow a boolean return, so the declared return is MapBoundaryReturn — the dynamic return Ruby has here.
Parameters
| Parameter | Type |
|---|---|
key | string |
block? | (key) => V |
Returns
any
No Rails Equivalent
PERMANENT — Ruby core Hash#delete (vendor/ruby/v3.3.11/hash.c:2441).
Overrides
Hash.delete
deleteIf()
deleteIf(
block):this
Defined in: packages/ruby-compat/dist/hash.d.ts:769
Hash#delete_if (vendor/ruby/v3.3.11/hash.c:2564 rb_hash_delete_if): drops every pair the block answers truthily for, and returns the receiver.
Parameters
| Parameter | Type |
|---|---|
block | (key, value) => unknown |
Returns
this
No Rails Equivalent
PERMANENT
Inherited from
Hash.deleteIf
dig()
dig(
key, ...identifiers):unknown
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:500
Mirrors dig (hash_with_indifferent_access.rb:208-211) — the first key is converted, then super is rb_hash_dig (vendor/ruby/v3.3.11/hash.c:4627), whose rb_hash_aref yields to the default_proc on a miss the way [] does, and whose remaining keys go to rb_obj_dig (vendor/ruby/v3.3.11/object.c:3906): nil ends the walk, an Array is indexed 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 — an object that answers dig is handed the rest, and anything else is no_dig_method's TypeError (object.c:3897-3900).
Parameters
| Parameter | Type |
|---|---|
key | string |
...identifiers | (string | number)[] |
Returns
unknown
Overrides
Hash.dig
dup()
dup():
HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:215
Returns
HashWithIndifferentAccess<V>
each()
each(
fn):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:462
Hash#each (vendor/ruby/v3.3.11/hash.c:7219), rb_hash_each_pair (hash.c:3149): yields the key and the value to a block taking two parameters (each_pair_i_fast) and one [key, value] pair otherwise (each_pair_i), and returns the receiver.
Parameters
| Parameter | Type |
|---|---|
fn | (pair) => void |
Returns
this
No Rails Equivalent
PERMANENT
Overrides
Hash.each
entries()
entries():
Generator<[string,V],undefined,unknown>
Defined in: packages/ruby-compat/dist/hash.d.ts:685
Map#entries, the pair walk under another name, so it goes through rb_hash_foreach (vendor/ruby/v3.3.11/hash.c:1438) as Hash#each_pair does (hash.c:3149).
Returns
Generator<[string, V], undefined, unknown>
No Rails Equivalent
PERMANENT — Ruby core Hash#each_pair (vendor/ruby/v3.3.11/hash.c:3149).
Inherited from
Hash.entries
except()
except(...
keys):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:280
Hash#except (vendor/ruby/v3.3.11/hash.c:2683 rb_hash_except); the body is except's.
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
HashWithIndifferentAccess<V>
No Rails Equivalent
PERMANENT
Overrides
Hash.except
exceptBang()
exceptBang(...
keys):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:284
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
HashWithIndifferentAccess<V>
extractBang()
extractBang(...
keys):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:403
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
HashWithIndifferentAccess<V>
fetch()
fetch(
key, ...extras):V
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:144
Hash#fetch (vendor/ruby/v3.3.11/hash.c:2176 rb_hash_fetch_m); the body is fetch's.
Parameters
| Parameter | Type |
|---|---|
key | string |
...extras | [] | [V | Block<V>] |
Returns
V
No Rails Equivalent
PERMANENT
Overrides
Hash.fetch
fetchValues()
fetchValues(...
args):V[]
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:152
Hash#fetch_values (vendor/ruby/v3.3.11/hash.c:2745rb_hash_fetch_values): rb_hash_fetch for each key.
Parameters
| Parameter | Type |
|---|---|
...args | (string | DefaultBlock<V>)[] |
Returns
V[]
No Rails Equivalent
PERMANENT
Overrides
Hash.fetchValues
find()
find(
fn): [string,V] |undefined
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:455
Parameters
| Parameter | Type |
|---|---|
fn | (pair) => boolean |
Returns
[string, V] | undefined
flatten()
flatten(...
argv):unknown[]
Defined in: packages/ruby-compat/dist/hash.d.ts:944
Hash#flatten (vendor/ruby/v3.3.11/hash.c:4308 rb_hash_flatten): the pairs spliced into one Array, then flatten!(level - 1) over it, or a recursive flatten! for a negative level.
Parameters
| Parameter | Type |
|---|---|
...argv | [] | [number] |
Returns
unknown[]
No Rails Equivalent
PERMANENT
Inherited from
Hash.flatten
forEach()
forEach(
callbackfn,thisArg?):void
Defined in: packages/ruby-compat/dist/hash.d.ts:692
Map#forEach, walked through rb_hash_foreach (vendor/ruby/v3.3.11/hash.c:1438) as Hash#each_pair is (hash.c:3149).
Parameters
| Parameter | Type |
|---|---|
callbackfn | (value, key, map) => void |
thisArg? | unknown |
Returns
void
No Rails Equivalent
PERMANENT — Ruby core Hash#each_pair (vendor/ruby/v3.3.11/hash.c:3149).
Inherited from
Hash.forEach
freeze()
freeze():
this
Defined in: packages/ruby-compat/dist/hash.d.ts:501
Object#freeze (vendor/ruby/v3.3.11/object.c:1284 rb_obj_freeze), which Hash#freeze (vendor/ruby/v3.3.11/hash.c:107) is. Object.freeze cannot serve: it seals a JS object's properties, and a Map's entries are not properties, so the seat is the FL_FREEZE flag rb_hash_modify_check reads.
Returns
this
No Rails Equivalent
PERMANENT — Ruby core Object#freeze (vendor/ruby/v3.3.11/object.c:1284).
Inherited from
Hash.freeze
get()
get(
key):V|undefined
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:88
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
V | undefined
Overrides
Hash.get
has()
has(
key):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:128
Hash#key? (vendor/ruby/v3.3.11/hash.c:3671 rb_hash_has_key), a lookup by the key's hash / eql?.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
No Rails Equivalent
PERMANENT — Ruby core Hash#key? (vendor/ruby/v3.3.11/hash.c:3671).
Overrides
Hash.has
hasKey()
hasKey(
key):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:136
Hash#key? / #has_key? (vendor/ruby/v3.3.11/hash.c:3671 rb_hash_has_key).
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
No Rails Equivalent
PERMANENT
Overrides
Hash.hasKey
hasValue()
hasValue(
val):boolean
Defined in: packages/ruby-compat/dist/hash.d.ts:539
Hash#has_value? (vendor/ruby/v3.3.11/hash.c:3697 rb_hash_has_value): rb_hash_search_value (:3680) compares each stored value with ==.
Parameters
| Parameter | Type |
|---|---|
val | unknown |
Returns
boolean
No Rails Equivalent
PERMANENT — Ruby core Hash#has_value? (vendor/ruby/v3.3.11/hash.c:3697).
Inherited from
Hash.hasValue
include()
include(
key):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:132
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
initializeCopy()
initializeCopy(
hash):this
Defined in: packages/ruby-compat/dist/hash.d.ts:700
Hash#initialize_copy, which MRI binds to rb_hash_replace (vendor/ruby/v3.3.11/hash.c:7190): the hook rbObjDup / rbObjClone dispatch, so a dup holds a copy of the receiver's table.
Parameters
| Parameter | Type |
|---|---|
hash | Hash<string, V> |
Returns
this
No Rails Equivalent
PERMANENT — Ruby core Hash#initialize_copy (vendor/ruby/v3.3.11/hash.c:7190).
Inherited from
Hash.initializeCopy
invert()
invert():
HashWithIndifferentAccess<string>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:481
Hash#invert (vendor/ruby/v3.3.11/hash.c:3900 rb_hash_invert): a new bare Hash mapping each value to its key.
Returns
HashWithIndifferentAccess<string>
No Rails Equivalent
PERMANENT
Overrides
Hash.invert
isCompareByIdentity()
isCompareByIdentity():
boolean
Defined in: packages/ruby-compat/dist/hash.d.ts:725
Hash#compare_by_identity? (vendor/ruby/v3.3.11/hash.c:4474rb_hash_compare_by_id_p).
Returns
boolean
No Rails Equivalent
PERMANENT — Ruby core Hash#compare_by_identity? (vendor/ruby/v3.3.11/hash.c:4474).
Inherited from
Hash.isCompareByIdentity
isDeepMerge()
isDeepMerge(
other):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:261
Parameters
| Parameter | Type |
|---|---|
other | unknown |
Returns
boolean
isEmpty()
isEmpty():
boolean
Defined in: packages/ruby-compat/dist/hash.d.ts:762
Hash#empty? (vendor/ruby/v3.3.11/hash.c:3023 rb_hash_empty_p).
Returns
boolean
No Rails Equivalent
PERMANENT
Inherited from
Hash.isEmpty
isExtractableOptions()
isExtractableOptions():
boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:84
Returns
boolean
isFrozen()
isFrozen():
boolean
Defined in: packages/ruby-compat/dist/hash.d.ts:508
Object#frozen? (vendor/ruby/v3.3.11/object.c:1301 rb_obj_frozen_p). Ruby's ? predicate suffix is is here, per the conventions.
Returns
boolean
No Rails Equivalent
PERMANENT — Ruby core Object#frozen? (vendor/ruby/v3.3.11/object.c:1301).
Inherited from
Hash.isFrozen
isInclude()
isInclude(
key):boolean
Defined in: packages/ruby-compat/dist/hash.d.ts:525
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
No Rails Equivalent
PERMANENT — Ruby core Hash#include? (vendor/ruby/v3.3.11/hash.c:7255, rb_hash_has_key :3671).
Inherited from
Hash.isInclude
isKey()
isKey(
key):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:124
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
isMember()
isMember(
key):boolean
Defined in: packages/ruby-compat/dist/hash.d.ts:822
Hash#member? (vendor/ruby/v3.3.11/hash.c:7239), rb_hash_has_key.
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
No Rails Equivalent
PERMANENT
Inherited from
Hash.isMember
keepIf()
keepIf(
block):this
Defined in: packages/ruby-compat/dist/hash.d.ts:783
Hash#keep_if (vendor/ruby/v3.3.11/hash.c:2844 rb_hash_keep_if): drops every pair the block answers falsily for (keep_if_i, :2757).
Parameters
| Parameter | Type |
|---|---|
block | (key, value) => unknown |
Returns
this
No Rails Equivalent
PERMANENT
Inherited from
Hash.keepIf
key()
key(
value):string|null
Defined in: packages/ruby-compat/dist/hash.d.ts:546
Hash#key (vendor/ruby/v3.3.11/hash.c:2354 rb_hash_key): the key of the first entry whose value is == to value (key_i, :2329), else nil.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
string | null
No Rails Equivalent
PERMANENT — Ruby core Hash#key (vendor/ruby/v3.3.11/hash.c:2354).
Inherited from
Hash.key
keys()
keys():
any
Defined in: packages/ruby-compat/dist/hash.d.ts:743
Hash#keys (vendor/ruby/v3.3.11/hash.c:3584 rb_hash_keys): an Array of the keys, where Map#keys is an iterator. A TS override may not narrow that return, so it declares MapBoundaryReturn, the same Map boundary delete meets.
Returns
any
No Rails Equivalent
PERMANENT — Ruby core Hash#keys (vendor/ruby/v3.3.11/hash.c:3584).
Inherited from
Hash.keys
length()
length():
number
Defined in: packages/ruby-compat/dist/hash.d.ts:756
Hash#length (vendor/ruby/v3.3.11/hash.c:3002 rb_hash_size).
Returns
number
No Rails Equivalent
PERMANENT
Inherited from
Hash.length
map()
map<
T>(fn):T[]
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:469
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | (pair) => T |
Returns
T[]
member()
member(
key):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:140
Parameters
| Parameter | Type |
|---|---|
key | string |
Returns
boolean
merge()
merge(...
hashes):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:163
Hash#merge (vendor/ruby/v3.3.11/hash.c:4144 rb_hash_merge), the method a :merge send finds; the body is merge's. The conflict block is the trailing argument, marked with block.
Parameters
| Parameter | Type |
|---|---|
...hashes | (AnyObject | HashWithIndifferentAccess<V> | BlockFn<V>)[] |
Returns
HashWithIndifferentAccess<V>
No Rails Equivalent
PERMANENT — Ruby core Hash#merge (vendor/ruby/v3.3.11/hash.c:4144).
Overrides
Hash.merge
mergeBang()
mergeBang(...
args):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:184
Hash#merge! (vendor/ruby/v3.3.11/hash.c:7247), defined onto rb_hash_update.
Parameters
| Parameter | Type |
|---|---|
...args | (AnyObject | HashWithIndifferentAccess<V> | BlockFn<V>)[] |
Returns
this
No Rails Equivalent
PERMANENT
Overrides
Hash.mergeBang
nestedUnderIndifferentAccess()
nestedUnderIndifferentAccess():
this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:563
Returns
this
none()
none(
fn?):boolean
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:441
Parameters
| Parameter | Type |
|---|---|
fn? | (pair) => boolean |
Returns
boolean
rassoc()
rassoc(
obj): [string,V] |null
Defined in: packages/ruby-compat/dist/hash.d.ts:936
Hash#rassoc (vendor/ruby/v3.3.11/hash.c:4254 rb_hash_rassoc): the first pair whose value is == to obj (rassoc_i), else nil.
Parameters
| Parameter | Type |
|---|---|
obj | unknown |
Returns
[string, V] | null
No Rails Equivalent
PERMANENT
Inherited from
Hash.rassoc
regularUpdate()
regularUpdate(
otherHashes,block?):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:113
Parameters
| Parameter | Type |
|---|---|
otherHashes | HashWithIndifferentAccess<V> |
block? | BlockFn<V> |
Returns
this
regularWriter()
regularWriter(
key,value):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:108
Parameters
| Parameter | Type |
|---|---|
key | string |
value | V |
Returns
this
reject()
Call Signature
reject():
Enumerator
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:316
Returns
Enumerator
Call Signature
reject(...
args):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:317
Parameters
| Parameter | Type |
|---|---|
...args | [(key, value) => boolean] |
Returns
HashWithIndifferentAccess<V>
rejectBang()
rejectBang(
block):HashWithIndifferentAccess<V> |null
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:328
Hash#reject! (vendor/ruby/v3.3.11/hash.c:2594 rb_hash_reject_bang): delete_if, answering nil when nothing was deleted.
Parameters
| Parameter | Type |
|---|---|
block | (key, value) => boolean |
Returns
HashWithIndifferentAccess<V> | null
No Rails Equivalent
PERMANENT
Overrides
Hash.rejectBang
replace()
replace(
otherHash):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:235
Hash#replace (vendor/ruby/v3.3.11/hash.c:2967 rb_hash_replace): the receiver takes hash2's default / default_proc (COPY_DEFAULT) and a hash_copy of its table, which is not written through a subclass's []=.
Parameters
| Parameter | Type |
|---|---|
otherHash | AnyObject | HashWithIndifferentAccess<V> |
Returns
this
No Rails Equivalent
PERMANENT — Ruby core Hash#replace (vendor/ruby/v3.3.11/hash.c:2967).
Overrides
Hash.replace
reverseMerge()
reverseMerge(
otherHash):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:219
Parameters
| Parameter | Type |
|---|---|
otherHash | AnyObject | HashWithIndifferentAccess<V> |
Returns
HashWithIndifferentAccess<V>
reverseMergeBang()
reverseMergeBang(
otherHash):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:227
Parameters
| Parameter | Type |
|---|---|
otherHash | AnyObject | HashWithIndifferentAccess<V> |
Returns
this
select()
Call Signature
select():
Enumerator
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:293
Returns
Enumerator
Call Signature
select(...
args):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:294
Parameters
| Parameter | Type |
|---|---|
...args | [(key, value) => boolean] |
Returns
HashWithIndifferentAccess<V>
selectBang()
selectBang(
block):HashWithIndifferentAccess<V> |null
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:305
Hash#select! (vendor/ruby/v3.3.11/hash.c:2813 rb_hash_select_bang): keep_if, answering nil when nothing was deleted.
Parameters
| Parameter | Type |
|---|---|
block | (key, value) => boolean |
Returns
HashWithIndifferentAccess<V> | null
No Rails Equivalent
PERMANENT
Overrides
Hash.selectBang
set()
set(
key,value):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:100
Hash#[]= (vendor/ruby/v3.3.11/hash.c:2018 rb_hash_aset), whose rb_hash_modify goes through rb_hash_modify_check (hash.c:1623).
Parameters
| Parameter | Type |
|---|---|
key | string |
value | V |
Returns
this
No Rails Equivalent
PERMANENT — Ruby core Hash#[]= (vendor/ruby/v3.3.11/hash.c:2018).
Overrides
Hash.set
setDefault()
setDefault(
value):void
Defined in: packages/ruby-compat/dist/hash.d.ts:608
Hash#default= (vendor/ruby/v3.3.11/hash.c:2265 rb_hash_set_default), whose SET_DEFAULT clears RHASH_PROC_DEFAULT. A TS set accessor cannot share a name with the default() reader, so it takes the conventions' setX() spelling.
Parameters
| Parameter | Type |
|---|---|
value | V | undefined |
Returns
void
No Rails Equivalent
PERMANENT — Ruby core Hash#default= (vendor/ruby/v3.3.11/hash.c:2265).
Inherited from
Hash.setDefault
setDefaultProc()
setDefaultProc(
proc):void
Defined in: packages/ruby-compat/dist/hash.d.ts:623
Hash#default_proc= (vendor/ruby/v3.3.11/hash.c:2308rb_hash_set_default_proc): nil goes through SET_DEFAULT, clearing the proc; anything that is not a Proc is a TypeError.
Parameters
| Parameter | Type |
|---|---|
proc | DefaultProc<string, V> | undefined |
Returns
void
No Rails Equivalent
PERMANENT — Ruby core Hash#default_proc= (vendor/ruby/v3.3.11/hash.c:2308).
Inherited from
Hash.setDefaultProc
shift()
shift(): [
string,V] |undefined
Defined in: packages/ruby-compat/dist/hash.d.ts:656
Hash#shift (vendor/ruby/v3.3.11/hash.c:2492 rb_hash_shift): removes the first entry and returns it as a [key, value] pair, nil for an empty hash, after rb_hash_modify_check. The entry is removed directly, with no lookup of its key, as st_shift does (hash.c:2515). MRI takes it through rb_hash_foreach only while the hash is being iterated, because st_shift may not run then; a Map drops its first entry either way.
Returns
[string, V] | undefined
No Rails Equivalent
PERMANENT — Ruby core Hash#shift (vendor/ruby/v3.3.11/hash.c:2492).
Inherited from
Hash.shift
slice()
slice(...
keys):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:265
Hash#slice (vendor/ruby/v3.3.11/hash.c:2651 rb_hash_slice); the body is slice's.
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
HashWithIndifferentAccess<V>
No Rails Equivalent
PERMANENT
Overrides
Hash.slice
sliceBang()
sliceBang(...
keys):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:270
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
HashWithIndifferentAccess<V>
store()
store(
key,value):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:104
Hash#store (vendor/ruby/v3.3.11/hash.c:7177), rb_hash_aset.
Parameters
| Parameter | Type |
|---|---|
key | string |
value | V |
Returns
this
No Rails Equivalent
PERMANENT
Overrides
Hash.store
stringifyKeys()
stringifyKeys():
HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:539
Returns
HashWithIndifferentAccess<V>
stringifyKeysBang()
stringifyKeysBang():
this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:543
Returns
this
symbolizeKeys()
symbolizeKeys():
AnyObject|Hash<string,unknown>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:547
Returns
AnyObject | Hash<string, unknown>
toA()
toA(): [
string,V][]
Defined in: packages/ruby-compat/dist/hash.d.ts:900
Hash#to_a (vendor/ruby/v3.3.11/hash.c:3428 rb_hash_to_a).
Returns
[string, V][]
No Rails Equivalent
PERMANENT
Inherited from
Hash.toA
toH()
Call Signature
toH():
Hash<string,V> |Record<string,V>
Defined in: packages/ruby-compat/dist/hash.d.ts:598
Hash#to_h (vendor/ruby/v3.3.11/hash.c:3555 rb_hash_to_h). With a block, rb_hash_to_h_block (hash.c:3528): a new bare Hash of the pairs the block returns, each checked by rb_hash_set_pair (hash.c:3503). With none, the receiver itself when it IS a Hash (hash.c:3560), otherwise a hash_dup (hash.c:3562) into a bare Hash that carries the same entries and the same default / default_proc. That bare Hash is a plain object when it needs no Hash feature (README, § "When a Ruby Hash is a Hash and when it is an object").
Returns
Hash<string, V> | Record<string, V>
No Rails Equivalent
PERMANENT — Ruby core Hash#to_h (vendor/ruby/v3.3.11/hash.c:3555).
Inherited from
Hash.toH
Call Signature
toH<
K2,V2>(block):Hash<K2,V2>
Defined in: packages/ruby-compat/dist/hash.d.ts:599
Hash#to_h (vendor/ruby/v3.3.11/hash.c:3555 rb_hash_to_h). With a block, rb_hash_to_h_block (hash.c:3528): a new bare Hash of the pairs the block returns, each checked by rb_hash_set_pair (hash.c:3503). With none, the receiver itself when it IS a Hash (hash.c:3560), otherwise a hash_dup (hash.c:3562) into a bare Hash that carries the same entries and the same default / default_proc. That bare Hash is a plain object when it needs no Hash feature (README, § "When a Ruby Hash is a Hash and when it is an object").
Type Parameters
| Type Parameter |
|---|
K2 |
V2 |
Parameters
| Parameter | Type |
|---|---|
block | (key, value) => [K2, V2] |
Returns
Hash<K2, V2>
No Rails Equivalent
PERMANENT — Ruby core Hash#to_h (vendor/ruby/v3.3.11/hash.c:3555).
Inherited from
Hash.toH
toHash()
toHash():
AnyObject|Hash<string,unknown>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:568
Returns
AnyObject | Hash<string, unknown>
Invented Arm
if — PERMANENT
Overrides
Hash.toHash
toJSON()
toJSON():
Record<string,V>
Defined in: packages/ruby-compat/dist/hash.d.ts:586
The JSON.stringify protocol: a Map's entries are not properties, so without it a Hash stringifies as {} where Hash#to_json (vendor/ruby/v3.3.11/ext/json/generator/generator.c:430 mHash_to_json) writes each pair under its key's to_s, a Symbol's being its name.
Returns
Record<string, V>
No Rails Equivalent
PERMANENT
Inherited from
Hash.toJSON
toOptions()
toOptions():
AnyObject|Hash<string,unknown>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:551
Returns
AnyObject | Hash<string, unknown>
toOptionsBang()
toOptionsBang():
this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:559
Returns
this
toParam()
toParam(
namespace?):string
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:531
Parameters
| Parameter | Type | Default value |
|---|---|---|
namespace | string | null | null |
Returns
string
toProc()
toProc(): (
key) =>V|undefined
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:574
Hash#to_proc (vendor/ruby/v3.3.11/hash.c:4752 rb_hash_to_proc): a lambda answering hash[key].
Returns
(key) => V | undefined
No Rails Equivalent
PERMANENT
Overrides
Hash.toProc
toQuery()
toQuery(
namespace?):string
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:527
Parameters
| Parameter | Type | Default value |
|---|---|---|
namespace | string | null | null |
Returns
string
transformKeys()
Call Signature
transformKeys():
Enumerator
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:332
Hash#transform_keys (vendor/ruby/v3.3.11/hash.c:3227 rb_hash_transform_keys): a new bare Hash keyed by hash2's mapping, else the block's result, else the key itself (transform_keys_hash_i, :3166), or by the block alone (transform_keys_i, :3182). The blockless Enumerator arm is not ported.
Returns
Enumerator
No Rails Equivalent
PERMANENT
Overrides
Hash.transformKeys
Call Signature
transformKeys(
block):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:333
Parameters
| Parameter | Type |
|---|---|
block | (key) => string |
Returns
HashWithIndifferentAccess<V>
Overrides
Hash.transformKeys
Call Signature
transformKeys(
hash,block?):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:334
Parameters
| Parameter | Type |
|---|---|
hash | AnyObject | null |
block? | (key) => string |
Returns
HashWithIndifferentAccess<V>
Overrides
Hash.transformKeys
transformKeysBang()
Call Signature
transformKeysBang():
Enumerator
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:359
Hash#transform_keys! (vendor/ruby/v3.3.11/hash.c:3267rb_hash_transform_keys_bang).
Returns
Enumerator
No Rails Equivalent
PERMANENT
Overrides
Hash.transformKeysBang
Call Signature
transformKeysBang(
block):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:360
Parameters
| Parameter | Type |
|---|---|
block | (key) => string |
Returns
this
Overrides
Hash.transformKeysBang
Call Signature
transformKeysBang(
hash,block?):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:361
Parameters
| Parameter | Type |
|---|---|
hash | AnyObject | null |
block? | (key) => string |
Returns
this
Overrides
Hash.transformKeysBang
transformValues()
transformValues<
W>(block):HashWithIndifferentAccess<W>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:382
Hash#transform_values (vendor/ruby/v3.3.11/hash.c:3366rb_hash_transform_values): a new Hash with each value replaced by the block's result.
Type Parameters
| Type Parameter | Default type |
|---|---|
W | V |
Parameters
| Parameter | Type |
|---|---|
block | (value) => W |
Returns
HashWithIndifferentAccess<W>
No Rails Equivalent
PERMANENT
Overrides
Hash.transformValues
transformValuesBang()
transformValuesBang(
block):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:388
Hash#transform_values! (vendor/ruby/v3.3.11/hash.c:3398rb_hash_transform_values_bang).
Parameters
| Parameter | Type |
|---|---|
block | (value) => V |
Returns
this
No Rails Equivalent
PERMANENT
Overrides
Hash.transformValuesBang
update()
update(...
args):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:169
Hash#update (vendor/ruby/v3.3.11/hash.c:4028 rb_hash_update); the body is update's.
Parameters
| Parameter | Type |
|---|---|
...args | (AnyObject | HashWithIndifferentAccess<V> | BlockFn<V>)[] |
Returns
this
No Rails Equivalent
PERMANENT
Overrides
Hash.update
values()
values():
any
Defined in: packages/ruby-compat/dist/hash.d.ts:750
Hash#values (vendor/ruby/v3.3.11/hash.c:3628 rb_hash_values): an Array of the values, where Map#values is an iterator.
Returns
any
No Rails Equivalent
PERMANENT — Ruby core Hash#values (vendor/ruby/v3.3.11/hash.c:3628).
Inherited from
Hash.values
valuesAt()
valuesAt(...
keys): (V|undefined)[]
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:148
Hash#values_at (vendor/ruby/v3.3.11/hash.c:2713 rb_hash_values_at): each key's rb_hash_aref, the default included.
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
(V | undefined)[]
No Rails Equivalent
PERMANENT
Overrides
Hash.valuesAt
withDefaults()
withDefaults(
otherHash):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:223
Parameters
| Parameter | Type |
|---|---|
otherHash | AnyObject | HashWithIndifferentAccess<V> |
Returns
HashWithIndifferentAccess<V>
withDefaultsBang()
withDefaultsBang(
otherHash):this
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:231
Parameters
| Parameter | Type |
|---|---|
otherHash | AnyObject | HashWithIndifferentAccess<V> |
Returns
this
withIndifferentAccess()
withIndifferentAccess():
HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:535
Returns
HashWithIndifferentAccess<V>
without()
without(...
keys):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:289
Parameters
| Parameter | Type |
|---|---|
...keys | string[] |
Returns
HashWithIndifferentAccess<V>
allocate()
staticallocate<T>(this):T
Defined in: packages/ruby-compat/dist/hash.d.ts:475
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
this | () => T |
Returns
T
No Rails Equivalent
PERMANENT — Ruby core Class#allocate (vendor/ruby/v3.3.11/object.c:2066).
Inherited from
Hash.allocate
get()
staticget<V>(...args):HashWithIndifferentAccess<V>
Defined in: packages/activesupport/lib/hash-with-indifferent-access.ts:59
Type Parameters
| Type Parameter | Default type |
|---|---|
V | unknown |
Parameters
| Parameter | Type |
|---|---|
...args | unknown[] |
Returns
HashWithIndifferentAccess<V>