class Moltrio::Config::EnvVariablesAdapter

Attributes

prefix[R]

Public Class Methods

new(prefix) click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 5
def initialize(prefix)
  @prefix = prefix
end

Public Instance Methods

[](key) click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 13
def [](key)
  ENV[to_env_variable(key)]
end
[]=(key, value) click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 17
def []=(key, value)
  ENV[to_env_variable(key)] = value
end
fetch(key, *args, &block) click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 25
def fetch(key, *args, &block)
  ENV.fetch(to_env_variable(key), *args, &block)
end
has_key?(key) click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 21
def has_key?(key)
  ENV.has_key?(to_env_variable(key))
end
missing_namespace?() click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 9
def missing_namespace?
  false
end

Private Instance Methods

to_env_variable(key) click to toggle source
# File lib/moltrio/config/adapters/env_variables_adapter.rb, line 32
def to_env_variable(key)
  [prefix, key.gsub('.', '_')].join("_").upcase
end