Class: TOML::Keygroup
- Inherits:
-
Object
- Object
- TOML::Keygroup
- Defined in:
- lib/toml/keygroup.rb
Instance Method Summary collapse
-
#initialize(nested_keys) ⇒ Keygroup
constructor
A new instance of Keygroup.
- #navigate_keys(hash, symbolize_keys = false) ⇒ Object
Constructor Details
#initialize(nested_keys) ⇒ Keygroup
Returns a new instance of Keygroup.
3 4 5 |
# File 'lib/toml/keygroup.rb', line 3 def initialize(nested_keys) @nested_keys = nested_keys end |
Instance Method Details
#navigate_keys(hash, symbolize_keys = false) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/toml/keygroup.rb', line 7 def navigate_keys(hash, symbolize_keys = false) @nested_keys.each do |key| key = symbolize_keys ? key.to_sym : key hash[key] = {} unless hash[key] hash = hash[key] end hash end |