Skip to content

Documentation


Documentation / @blazetrails/rack / Headers

Class: Headers ​

Defined in: packages/rack/lib/headers.ts:90

Extends ​

  • Hash<string, string>

Constructors ​

Constructor ​

new Headers(ifnone?, block?): Headers

Defined in: packages/ruby-compat/dist/hash.d.ts:484

Hash.new (vendor/ruby/v3.3.11/hash.c:1782 rb_hash_initialize): a block is the default_proc, an argument the default value, neither is nil. A block is a single trailing function argument, the spelling fetch uses, and a block beside a default is rb_check_arity(argc, 0, 0)'s ArgumentError.

Parameters ​

ParameterType
ifnone?string | DefaultProc<string, string>
block?DefaultProc<string, string>

Returns ​

Headers

No Rails Equivalent ​

PERMANENT — Ruby core Hash.new (vendor/ruby/v3.3.11/hash.c:1782).

Inherited from ​

Hash<string, string>.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 ​

readonly size: 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] ​

readonly static [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]


KNOWN_HEADERS ​

static KNOWN_HEADERS: Record<string, string>

Defined in: packages/rack/lib/headers.ts:91

Methods ​

[iterator]() ​

[iterator](): Generator<[string, string], 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, string], undefined, unknown>

No Rails Equivalent ​

PERMANENT — Ruby core rb_hash_foreach (vendor/ruby/v3.3.11/hash.c:1438).

Inherited from ​

Hash.[iterator]


assoc() ​

assoc(key): [string, string] | null

Defined in: packages/rack/lib/headers.ts:127

Hash#assoc (vendor/ruby/v3.3.11/hash.c:4193 rb_hash_assoc): the stored key and its value for key, else nil.

Parameters ​

ParameterType
keystring

Returns ​

[string, string] | 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(): Hash<string, string>

Defined in: packages/ruby-compat/dist/hash.d.ts:951

Hash#compact (vendor/ruby/v3.3.11/hash.c:4360 rb_hash_compact): a dup with every nil value dropped (delete_if_nil).

Returns ​

Hash<string, string>

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.compact


compactBang() ​

compactBang(): Headers | null

Defined in: packages/ruby-compat/dist/hash.d.ts:957

Hash#compact! (vendor/ruby/v3.3.11/hash.c:4385 rb_hash_compact_bang).

Returns ​

Headers | null

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.compactBang


compareByIdentity() ​

compareByIdentity(): never

Defined in: packages/rack/lib/headers.ts:131

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 ​

never

No Rails Equivalent ​

PERMANENT — Ruby core Hash#compare_by_identity (vendor/ruby/v3.3.11/hash.c:4427).

Overrides ​

Hash.compareByIdentity


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 ​

ParameterType
_keysunknown

Returns ​

this

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.deconstructKeys


default() ​

default(...key): string | undefined

Defined in: packages/ruby-compat/dist/hash.d.ts:577

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 ​

ParameterType
...key[] | [string]

Returns ​

string | undefined

No Rails Equivalent ​

PERMANENT — Ruby core Hash#default (vendor/ruby/v3.3.11/hash.c:2238).

Inherited from ​

Hash.default


defaultProc() ​

defaultProc(): DefaultProc<string, string> | 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, string> | 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/rack/lib/headers.ts:135

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 ​

ParameterType
keystring
block?(key) => string

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 ​

ParameterType
block(key, value) => unknown

Returns ​

this

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.deleteIf


dig() ​

dig(key, ...a): unknown

Defined in: packages/rack/lib/headers.ts:139

Hash#dig (vendor/ruby/v3.3.11/hash.c:4627 rb_hash_dig): self[key], then rb_obj_dig (vendor/ruby/v3.3.11/object.c:3906) over the rest, which answers nil through a nil and sends dig to anything else.

Parameters ​

ParameterType
keystring
...aunknown[]

Returns ​

unknown

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.dig


each() ​

each(block): this

Defined in: packages/ruby-compat/dist/hash.d.ts:734

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 ​

ParameterType
block((pair) => void) | ((key, value) => void)

Returns ​

this

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.each


entries() ​

entries(): Generator<[string, string], 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, string], 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(...a): Hash<string, string>

Defined in: packages/rack/lib/headers.ts:248

Hash#except (vendor/ruby/v3.3.11/hash.c:2683 rb_hash_except); the body is except's.

Parameters ​

ParameterType
...astring[]

Returns ​

Hash<string, string>

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.except


fetch() ​

fetch(key, ...defaultValue): string

Defined in: packages/rack/lib/headers.ts:143

Hash#fetch (vendor/ruby/v3.3.11/hash.c:2176 rb_hash_fetch_m); the body is fetch's.

Parameters ​

ParameterType
keystring
...defaultValueany[]

Returns ​

string

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.fetch


fetchValues() ​

fetchValues(...a): string[]

Defined in: packages/rack/lib/headers.ts:148

Hash#fetch_values (vendor/ruby/v3.3.11/hash.c:2745rb_hash_fetch_values): rb_hash_fetch for each key.

Parameters ​

ParameterType
...astring[]

Returns ​

string[]

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.fetchValues


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 ​

ParameterType
...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 ​

ParameterType
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): string | undefined

Defined in: packages/rack/lib/headers.ts:112

Parameters ​

ParameterType
keystring

Returns ​

string | undefined

Overrides ​

Hash.get


has() ​

has(key): boolean

Defined in: packages/ruby-compat/dist/hash.d.ts:532

Hash#key? (vendor/ruby/v3.3.11/hash.c:3671 rb_hash_has_key), a lookup by the key's hash / eql?.

Parameters ​

ParameterType
keystring

Returns ​

boolean

No Rails Equivalent ​

PERMANENT — Ruby core Hash#key? (vendor/ruby/v3.3.11/hash.c:3671).

Inherited from ​

Hash.has


hasKey() ​

hasKey(key): boolean

Defined in: packages/rack/lib/headers.ts:152

Hash#key? / #has_key? (vendor/ruby/v3.3.11/hash.c:3671 rb_hash_has_key).

Parameters ​

ParameterType
keystring

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 ​

ParameterType
valunknown

Returns ​

boolean

No Rails Equivalent ​

PERMANENT — Ruby core Hash#has_value? (vendor/ruby/v3.3.11/hash.c:3697).

Inherited from ​

Hash.hasValue


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 ​

ParameterType
hashHash<string, string>

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(): Headers

Defined in: packages/rack/lib/headers.ts:164

Hash#invert (vendor/ruby/v3.3.11/hash.c:3900 rb_hash_invert): a new bare Hash mapping each value to its key.

Returns ​

Headers

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


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


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/rack/lib/headers.ts:156

Parameters ​

ParameterType
keystring

Returns ​

boolean

No Rails Equivalent ​

PERMANENT — Ruby core Hash#include? (vendor/ruby/v3.3.11/hash.c:7255, rb_hash_has_key :3671).

Overrides ​

Hash.isInclude


isMember() ​

isMember(key): boolean

Defined in: packages/rack/lib/headers.ts:160

Hash#member? (vendor/ruby/v3.3.11/hash.c:7239), rb_hash_has_key.

Parameters ​

ParameterType
keystring

Returns ​

boolean

No Rails Equivalent ​

PERMANENT

Overrides ​

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 ​

ParameterType
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 ​

ParameterType
valueunknown

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


merge() ​

merge(hash, block?): Headers

Defined in: packages/rack/lib/headers.ts:172

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 ​

ParameterType
hashRecord<string, string> | Headers
block?(key, oldVal, newVal) => string

Returns ​

Headers

No Rails Equivalent ​

PERMANENT — Ruby core Hash#merge (vendor/ruby/v3.3.11/hash.c:4144).

Overrides ​

Hash.merge


mergeBang() ​

mergeBang(hash, block?): this

Defined in: packages/rack/lib/headers.ts:217

Hash#merge! (vendor/ruby/v3.3.11/hash.c:7247), defined onto rb_hash_update.

Parameters ​

ParameterType
hashRecord<string, string> | Headers
block?(key, oldVal, newVal) => string

Returns ​

this

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.mergeBang


rassoc() ​

rassoc(obj): [string, string] | 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 ​

ParameterType
objunknown

Returns ​

[string, string] | null

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.rassoc


reject() ​

reject(block): Headers

Defined in: packages/rack/lib/headers.ts:179

Parameters ​

ParameterType
blockPairBlock

Returns ​

Headers


rejectBang() ​

rejectBang(block): Headers | null

Defined in: packages/ruby-compat/dist/hash.d.ts:776

Hash#reject! (vendor/ruby/v3.3.11/hash.c:2594 rb_hash_reject_bang): delete_if, answering nil when nothing was deleted.

Parameters ​

ParameterType
block(key, value) => unknown

Returns ​

Headers | null

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.rejectBang


replace() ​

replace(hash): this

Defined in: packages/rack/lib/headers.ts:185

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 ​

ParameterType
hashRecord<string, string> | Headers

Returns ​

this

No Rails Equivalent ​

PERMANENT — Ruby core Hash#replace (vendor/ruby/v3.3.11/hash.c:2967).

Overrides ​

Hash.replace


select() ​

select(block): Headers

Defined in: packages/rack/lib/headers.ts:190

Parameters ​

ParameterType
blockPairBlock

Returns ​

Headers


selectBang() ​

selectBang(block): Headers | null

Defined in: packages/ruby-compat/dist/hash.d.ts:790

Hash#select! (vendor/ruby/v3.3.11/hash.c:2813 rb_hash_select_bang): keep_if, answering nil when nothing was deleted.

Parameters ​

ParameterType
block(key, value) => unknown

Returns ​

Headers | null

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.selectBang


set() ​

set(key, value): this

Defined in: packages/rack/lib/headers.ts:116

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 ​

ParameterType
keystring
valuestring

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 ​

ParameterType
valuestring | 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 ​

ParameterType
procDefaultProc<string, string> | 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, string] | 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, string] | undefined

No Rails Equivalent ​

PERMANENT — Ruby core Hash#shift (vendor/ruby/v3.3.11/hash.c:2492).

Inherited from ​

Hash.shift


slice() ​

slice(...a): Headers

Defined in: packages/rack/lib/headers.ts:228

Hash#slice (vendor/ruby/v3.3.11/hash.c:2651 rb_hash_slice); the body is slice's.

Parameters ​

ParameterType
...astring[]

Returns ​

Headers

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.slice


store() ​

store(key, value): this

Defined in: packages/rack/lib/headers.ts:123

Hash#store (vendor/ruby/v3.3.11/hash.c:7177), rb_hash_aset.

Parameters ​

ParameterType
keystring
valuestring

Returns ​

this

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.store


toA() ​

toA(): [string, string][]

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, string][]

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.toA


toH() ​

Call Signature ​

toH(): Record<string, string> | Hash<string, string>

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 ​

Record<string, string> | Hash<string, string>

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 ​
ParameterType
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(): object

Defined in: packages/ruby-compat/dist/hash.d.ts:907

Hash#to_hash (vendor/ruby/v3.3.11/hash.c:3497 rb_hash_to_hash): the receiver itself.

Returns ​

object

No Rails Equivalent ​

PERMANENT

Inherited from ​

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


toProc() ​

toProc(): (x) => string | null | undefined

Defined in: packages/rack/lib/headers.ts:196

Hash#to_proc (vendor/ruby/v3.3.11/hash.c:4752 rb_hash_to_proc): a lambda answering hash[key].

Returns ​

(x) => string | null | undefined

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.toProc


transformKeys() ​

transformKeys(block): Headers

Defined in: packages/rack/lib/headers.ts:236

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.

Parameters ​

ParameterType
block(key) => string

Returns ​

Headers

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.transformKeys


transformKeysBang() ​

transformKeysBang(block): this

Defined in: packages/rack/lib/headers.ts:240

Hash#transform_keys! (vendor/ruby/v3.3.11/hash.c:3267rb_hash_transform_keys_bang).

Parameters ​

ParameterType
block(key) => string

Returns ​

this

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.transformKeysBang


transformValues() ​

transformValues(block): Headers

Defined in: packages/rack/lib/headers.ts:200

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.

Parameters ​

ParameterType
block(value) => string

Returns ​

Headers

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.transformValues


transformValuesBang() ​

transformValuesBang(block): this

Defined in: packages/ruby-compat/dist/hash.d.ts:797

Hash#transform_values! (vendor/ruby/v3.3.11/hash.c:3398rb_hash_transform_values_bang).

Parameters ​

ParameterType
block(value) => string

Returns ​

this

No Rails Equivalent ​

PERMANENT

Inherited from ​

Hash.transformValuesBang


update() ​

update(hash, block?): this

Defined in: packages/rack/lib/headers.ts:204

Hash#update (vendor/ruby/v3.3.11/hash.c:4028 rb_hash_update); the body is update's.

Parameters ​

ParameterType
hashRecord<string, string> | Headers
block?(key, oldVal, newVal) => string

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): (string | null | undefined)[]

Defined in: packages/rack/lib/headers.ts:224

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 ​

ParameterType
...keysstring[]

Returns ​

(string | null | undefined)[]

No Rails Equivalent ​

PERMANENT

Overrides ​

Hash.valuesAt


allocate() ​

static allocate<T>(this): T

Defined in: packages/ruby-compat/dist/hash.d.ts:475

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
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() ​

static get(...items): Headers

Defined in: packages/rack/lib/headers.ts:93

Parameters ​

ParameterType
...itemsany[]

Returns ​

Headers