Class: Dacs::EnvironmentSource
- Inherits:
-
Object
- Object
- Dacs::EnvironmentSource
- Defined in:
- lib/dacs/environment_source.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(prefix, environment = ENV) ⇒ EnvironmentSource
constructor
A new instance of EnvironmentSource.
- #to_s ⇒ Object
Constructor Details
#initialize(prefix, environment = ENV) ⇒ EnvironmentSource
Returns a new instance of EnvironmentSource.
3 4 5 6 |
# File 'lib/dacs/environment_source.rb', line 3 def initialize(prefix, environment=ENV) @prefix = prefix @environment = environment end |
Instance Method Details
#each ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/dacs/environment_source.rb', line 12 def each @environment.each_pair do |key, value| if match = /^#{@prefix.downcase}(.*)$/.match(key.downcase) yield ConfiguredValue.new(self, match[1], value) end end end |
#to_s ⇒ Object
8 9 10 |
# File 'lib/dacs/environment_source.rb', line 8 def to_s "environment" end |