Class Mash
In: lib/merb-core/core_ext/mash.rb
Parent: Hash

This class has dubious semantics and we only have it so that people can write params[:key] instead of params[‘key’].

Methods

[]=   convert_key   convert_value   default   delete   dup   fetch   key?   merge   new   stringify_keys!   to_hash   update   values_at  

External Aliases

[]= -> regular_writer

Public Class methods

Parameters

constructor<Object>:The default value for the mash. Defaults to an empty hash.

Alternatives

If constructor is a Hash, a new mash will be created based on the keys of the hash and no default value will be set.

Public Instance methods

Parameters

key<Object>:The key to set. This will be run through convert_key.
value<Object>:The value to set the key to. This will be run through convert_value.

Parameters

key<Object>:The key to convert.

Returns

Object:The converted key. If the key was a symbol, it will be converted to a string.

Parameters

value<Object>:The value to convert.

Returns

Object:The converted value. A Hash or an Array of hashes, will be converted to their Mash equivalents.

Parameters

key<Object>:The default value for the mash. Defaults to nil.

Alternatives

If key is a Symbol and it is a key in the mash, then the default value will be set to the value matching the key.

Parameters

key<Object>:The key to delete from the mash. This will be run through convert_key.

Returns

Mash:A duplicate of this mash.

Parameters

key<Object>:The key to fetch. This will be run through convert_key.
extras:Default value.

Returns

Object:The value at key or the default value.

Parameters

key<Object>:The key to check for. This will be run through convert_key.

Returns

Boolean:True if the key exists in the mash.

Parameters

hash<Hash>:The hash to merge with the mash.

Returns

Mash:A new mash with the hash values merged in.

Used to provide the same interface as Hash.

Returns

Mash:This mash unchanged.

Returns

Hash:The mash as a Hash with string keys.

Parameters

other_hash<Hash>:: A hash to update values in the mash with. The keys and the values will be converted to Mash format.

Returns

Mash:The updated mash.

Parameters

indices<Array>:The keys to retrieve values for. These will be run through convert_key.

[Validate]