Class: IML::Hash
- Inherits:
-
HashWithIndifferentAccess
- Object
- HashWithIndifferentAccess
- IML::Hash
- Defined in:
- lib/iml/hash.rb
Overview
IML’s own re-implementation of hash with key/method funky patch and active_supports HashWithIndeifferetAccess
Instance Method Summary collapse
-
#method_missing(method_name) ⇒ Object
Way to access Hash keys by method_name.
-
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Responds true for methods that have names of Hash keys.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
Way to access Hash keys by method_name
6 7 8 |
# File 'lib/iml/hash.rb', line 6 def method_missing(method_name) key?(method_name) ? self[method_name] : super end |
Instance Method Details
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Returns Responds true for methods that have names of Hash keys.
11 12 13 |
# File 'lib/iml/hash.rb', line 11 def respond_to_missing?(method_name, _include_private = false) key?(method_name) || false end |