Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/js_obj.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, value = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/js_obj.rb', line 4 def method_missing name, value=nil if name.match(/=$/) self[name[0..-2].intern] = value elsif !name.nil? key?(name) ? self[name] : self[name.to_s] else super end end |