Class: FunctionalHash
- Inherits:
-
Hash
- Object
- Hash
- FunctionalHash
- Defined in:
- lib/functional_hash.rb,
lib/functional_hash/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
Instance Method Details
#[](*args) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/functional_hash.rb', line 2 def [](*args) key = args.shift if fetch(key).is_a? Proc if fetch(key).arity == 0 fetch(key).call else args.unshift(self) fetch(key).call(*args) end else super(key) end end |