Class: Co2Filter::HashWrapper
- Inherits:
-
Object
- Object
- Co2Filter::HashWrapper
- Defined in:
- lib/co2_filter/hash_wrapper.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(data) ⇒ HashWrapper
constructor
A new instance of HashWrapper.
- #method_missing(method, *args, &block) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(data) ⇒ HashWrapper
Returns a new instance of HashWrapper.
2 3 4 |
# File 'lib/co2_filter/hash_wrapper.rb', line 2 def initialize(data) @data = data.to_hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/co2_filter/hash_wrapper.rb', line 6 def method_missing(method, *args, &block) if [:keys, :values, :length, :size, :"[]", :"[]=", :each, :merge] @data.send(method, *args, &block) else super(method, *args, &block) end end |
Instance Method Details
#to_hash ⇒ Object
14 15 16 |
# File 'lib/co2_filter/hash_wrapper.rb', line 14 def to_hash @data end |