Class: ConfigX::HashSource
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(source) ⇒ HashSource
constructor
A new instance of HashSource.
- #load ⇒ Object
Constructor Details
#initialize(source) ⇒ HashSource
Returns a new instance of HashSource.
23 24 25 |
# File 'lib/config_x/hash_source.rb', line 23 def initialize(source) @source = source end |
Class Method Details
.deep_stringify_keys(hash) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/config_x/hash_source.rb', line 11 def deep_stringify_keys(hash) hash.each_with_object({}) do |(key, value), acc| acc[key.to_s] = if Hash === value deep_stringify_keys(value) else value end end end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 |
# File 'lib/config_x/hash_source.rb', line 31 def ==(other) other.is_a?(self.class) && source == other.source end |
#load ⇒ Object
27 28 29 |
# File 'lib/config_x/hash_source.rb', line 27 def load self.class.deep_stringify_keys(source) end |