Class: ConfigRC::EnvironmentProvider

Inherits:
BaseProvider show all
Defined in:
lib/config-rc/environment.rb

Overview

Configuration stored as environment variable

Instance Method Summary collapse

Methods inherited from BaseProvider

#to_s

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

#mapObject



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