Class: Hash
- Inherits:
-
Object
show all
- Defined in:
- lib/extensions.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
13
14
15
|
# File 'lib/extensions.rb', line 13
def method_missing(method, *args)
self["#{method}"]
end
|
Instance Method Details
#stringify_keys! ⇒ Object
6
7
8
9
10
11
|
# File 'lib/extensions.rb', line 6
def stringify_keys!
keys.each do |key|
self[key.to_s] = delete(key)
end
self
end
|
#to_struct(struct_name) ⇒ Object
2
3
4
|
# File 'lib/extensions.rb', line 2
def to_struct(struct_name)
Struct.new(struct_name,*keys).new(*values)
end
|