class Locd::Config::Base
@todo document Locd::Config::Base
class.
Attributes
key_separator[R]
TODO document `key_separator` attribute.
@return [attr_type]
Public Class Methods
new(source:, parent: nil, key_separator: '.')
click to toggle source
Instantiate a new `Locd::Config::Base`.
# File lib/locd/config/base.rb, line 52 def initialize source:, parent: nil, key_separator: '.' @source = source @parent = parent @key_separator = key_separator end
Public Instance Methods
dig(*key_path)
click to toggle source
# File lib/locd/config/base.rb, line 67 def dig *key_path if key_path.length == 1 if source.key? key_path[0] return source[key_path[0]] end else just_before = source.dig key_path[0...-1] if just_before.respond_to?( :key? ) && just_before.key? key_path[-1] return just_before[key_path[-1]] end end if parent parent.dig key_path else nil end end
get(*key)
click to toggle source
# File lib/locd/config/base.rb, line 88 def get *key dig key_path_for( *key ) end