Class: BlendedConfig::Source

Inherits:
Struct
  • Object
show all
Defined in:
lib/blended_config/source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#raw_sourceObject

Returns the value of attribute raw_source

Returns:

  • (Object)

    the current value of raw_source



2
3
4
# File 'lib/blended_config/source.rb', line 2

def raw_source
  @raw_source
end

Instance Method Details

#[](key) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/blended_config/source.rb', line 11

def [](key)
  key_fragments = prefixes + [key]

  key_fragments.reduce(raw_source) do |value, key_fragment|
    value[key_fragment.to_s]
  end
end

#prefix_with(prefix) ⇒ Object



7
8
9
# File 'lib/blended_config/source.rb', line 7

def prefix_with(prefix)
  prefixes << prefix
end

#prefixesObject



3
4
5
# File 'lib/blended_config/source.rb', line 3

def prefixes
  @prefixes ||= []
end