Class: Hash

Inherits:
Object show all
Includes:
HashEx
Defined in:
lib/ext/hash.rb

Direct Known Subclasses

Mobj::CircleHash

Instance Method Summary collapse

Instance Method Details

#[](*fkeys) ⇒ Object



91
92
93
# File 'lib/ext/hash.rb', line 91

def [](*fkeys)
  fkeys.map { |key| mlookup(key) || mfetch(key.sym) { mfetch(key.to_s) { mfetch(ki(key).sym) { mfetch(ki(key).to_s) { mdef(key) } } } } }.sequester!
end

#mlookupObject



87
# File 'lib/ext/hash.rb', line 87

alias_method :mlookup, :[]

#sym(recurse = false) ⇒ Object



95
96
97
98
99
# File 'lib/ext/hash.rb', line 95

def sym(recurse=false)
  each.with_object({}) do |(key, value), o|
    o[key.sym] = recurse ? value.sym : value
  end
end