Class: Qismo::ObjectifiedHash
- Inherits:
-
Hash
- Object
- Hash
- Qismo::ObjectifiedHash
- Defined in:
- lib/qismo/objectified_hash.rb
Overview
Objectified hash interface for accesing hash using dot notation
Instance Method Summary collapse
-
#method_missing(method, *args, &block) ⇒ Object
method missing patch.
-
#respond_to?(method_name, include_private = false) ⇒ Boolean
respond to patch.
-
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
respond to missing patch.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
method missing patch
6 7 8 9 10 |
# File 'lib/qismo/objectified_hash.rb', line 6 def method_missing(method, *args, &block) return super unless respond_to?(method) fetch(method.to_s) end |
Instance Method Details
#respond_to?(method_name, include_private = false) ⇒ Boolean
respond to patch
13 14 15 16 17 18 19 |
# File 'lib/qismo/objectified_hash.rb', line 13 def respond_to?(method_name, include_private = false) fetch(method_name.to_s) true rescue KeyError super(method_name, include_private) end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
respond to missing patch
22 23 24 25 26 27 28 |
# File 'lib/qismo/objectified_hash.rb', line 22 def respond_to_missing?(method_name, include_private = false) fetch(method_name.to_s) true rescue KeyError super(method_name, include_private) end |