Class: Greenpeace::Configuration::Requirement
- Inherits:
-
Object
- Object
- Greenpeace::Configuration::Requirement
- Defined in:
- lib/greenpeace/configuration/requirement.rb
Overview
Represents an environment requirement
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(key, options, environment) ⇒ Requirement
constructor
A new instance of Requirement.
- #value ⇒ Object
Constructor Details
#initialize(key, options, environment) ⇒ Requirement
Returns a new instance of Requirement.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/greenpeace/configuration/requirement.rb', line 12 def initialize(key, , environment) @environment = environment @key = Greenpeace::Configuration::Key.new(key) @type = Greenpeace::Configuration::Type.new(, :type) @doc = Greenpeace::Configuration::Doc.new(, :doc) @default = Greenpeace::Configuration::Default.new( @type, , nil, :defaults) end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
10 11 12 |
# File 'lib/greenpeace/configuration/requirement.rb', line 10 def key @key end |
Instance Method Details
#identifier ⇒ Object
24 25 26 |
# File 'lib/greenpeace/configuration/requirement.rb', line 24 def identifier @key.identifier end |
#value ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/greenpeace/configuration/requirement.rb', line 28 def value value = ENV[@key.env_identifier] if value.nil? || value.empty? try_with_environment_values else @type.convert(value) end end |