Class: DeepStruct::Hash
- Inherits:
-
Hash
- Object
- Hash
- DeepStruct::Hash
show all
- Defined in:
- lib/deep_struct/hash.rb
Instance Method Summary
collapse
Constructor Details
#initialize(hash) ⇒ Hash
Returns a new instance of Hash.
3
4
5
6
7
|
# File 'lib/deep_struct/hash.rb', line 3
def initialize(hash)
hash.each do |k, v|
self[k.to_sym] = v
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args, &block) ⇒ Object
13
14
15
|
# File 'lib/deep_struct/hash.rb', line 13
def method_missing(key, *args, &block)
self[key]
end
|
Instance Method Details
#responds_to?(method) ⇒ Boolean
17
18
19
|
# File 'lib/deep_struct/hash.rb', line 17
def responds_to?(method)
self[method]
end
|