Class CastingHash
In: lib/hashery/castinghash.rb
Parent: Hash

CastingHash is just like Hash, except that all keys and values are passed through casting procedures.

Methods

<<   []   []   []=   delete   fetch   has_key?   key?   key_proc   key_proc=   merge!   new   rekey   rekey!   replace   store   to_h   to_hash   update   value_proc   value_proc=   values_at  

Constants

KEY_PROC = lambda{ |x| x }   Default key conversion procedure.
VAL_PROC = lambda{ |x| x }   Default value conversion procedure.

Public Class methods

Public Instance methods

Synonym for Hash#rekey, but modifies the receiver in place (and returns it).

  foo = { :name=>'Gavin', :wife=>:Lisa }.to_stash
  foo.rekey!{ |k| k.upcase }  #=>  { "NAME"=>"Gavin", "WIFE"=>:Lisa }
  foo.inspect                 #=>  { "NAME"=>"Gavin", "WIFE"=>:Lisa }
to_h()

Alias for to_hash

[Validate]