Class: Hash
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#[](*fkeys) ⇒ Object
88 89 90 |
# File 'lib/ext/hash.rb', line 88 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 |
#denil ⇒ Object
98 99 100 |
# File 'lib/ext/hash.rb', line 98 def denil reject{ |k, v| k.nil? || v.nil? } end |
#mlookup ⇒ Object
84 |
# File 'lib/ext/hash.rb', line 84 alias_method :mlookup, :[] |
#sym(recurse = false) ⇒ Object
92 93 94 95 96 |
# File 'lib/ext/hash.rb', line 92 def sym(recurse=false) each.with_object({}) do |(key, value), o| o[key.sym] = recurse ? value.sym : value end end |