Module: HashWithKeyAccessMethod
- Included in:
- Hash
- Defined in:
- lib/hash_with_key_access_method.rb,
lib/hash_with_key_access_method/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/hash_with_key_access_method.rb', line 4 def method_missing name, *args if name =~ /=$/ self[name[0..-2].to_sym] = args[0] else super unless has_key?(name) self[name] end end |