Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/conjoin/recursive_ostruct.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#to_ostruct(options = {}) ⇒ Object
options: :exclude => [keys] - keys need to be symbols.
- #with_sym_keys ⇒ Object
Instance Method Details
#to_ostruct(options = {}) ⇒ Object
options:
:exclude => [keys] - keys need to be symbols
7 8 9 |
# File 'lib/conjoin/recursive_ostruct.rb', line 7 def to_ostruct( = {}) convert_to_ostruct_recursive(self, ) end |
#with_sym_keys ⇒ Object
11 12 13 14 |
# File 'lib/conjoin/recursive_ostruct.rb', line 11 def with_sym_keys # self.inject({}) { |memo, (k,v)| memo[k.to_sym] = v; memo } self.each_with_object({}) { |(k,v), memo| memo[k.to_sym] = v } end |