Class: ENVied::EnvProxy
- Inherits:
-
Object
- Object
- ENVied::EnvProxy
- Defined in:
- lib/envied/env_proxy.rb
Overview
Responsible for anything related to the ENV.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #has_key?(name) ⇒ Boolean
-
#initialize(config, **options) ⇒ EnvProxy
constructor
A new instance of EnvProxy.
- #missing_variables ⇒ Object
- #uncoercible_variables ⇒ Object
- #value_to_coerce(var) ⇒ Object
Constructor Details
Instance Method Details
#[](name) ⇒ Object
21 22 23 |
# File 'lib/envied/env_proxy.rb', line 21 def [](name) coerce(variables_by_name[name.to_sym]) end |
#has_key?(name) ⇒ Boolean
25 26 27 |
# File 'lib/envied/env_proxy.rb', line 25 def has_key?(name) variables_by_name[name.to_sym] end |
#missing_variables ⇒ Object
13 14 15 |
# File 'lib/envied/env_proxy.rb', line 13 def missing_variables variables.select(&method(:missing?)) end |
#uncoercible_variables ⇒ Object
17 18 19 |
# File 'lib/envied/env_proxy.rb', line 17 def uncoercible_variables variables.reject(&method(:coerced?)).reject(&method(:coercible?)) end |
#value_to_coerce(var) ⇒ Object
29 30 31 32 |
# File 'lib/envied/env_proxy.rb', line 29 def value_to_coerce(var) return env_value_of(var) unless env_value_of(var).nil? config.defaults_enabled? ? default_value_of(var) : nil end |