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



78
79
80
# File 'lib/ext/hash.rb', line 78

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



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

alias_method :mlookup, :[]

#sym(recurse = false) ⇒ Object



82
83
84
85
86
# File 'lib/ext/hash.rb', line 82

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