Class: ConfigRC::EnvironmentProvider
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- ConfigRC::EnvironmentProvider
- Defined in:
- lib/config-rc/environment.rb
Overview
Configuration stored as environment variable
Instance Method Summary collapse
-
#initialize(prefix) ⇒ EnvironmentProvider
constructor
A new instance of EnvironmentProvider.
- #map ⇒ Object
Methods inherited from BaseProvider
Constructor Details
#initialize(prefix) ⇒ EnvironmentProvider
Returns a new instance of EnvironmentProvider.
6 7 8 |
# File 'lib/config-rc/environment.rb', line 6 def initialize(prefix) @prefix = "#{prefix}_" end |
Instance Method Details
#map ⇒ Object
10 11 12 |
# File 'lib/config-rc/environment.rb', line 10 def map ENV.select{|k, v| k.start_with?(@prefix)}.each_with_object({}){|(k, v), h| h[k.gsub(@prefix, '')] = v} end |