Class: Seijaku::Variable
- Inherits:
-
Object
- Object
- Seijaku::Variable
- Defined in:
- lib/seijaku/variable.rb
Overview
variable
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(variable) ⇒ Variable
constructor
A new instance of Variable.
Constructor Details
#initialize(variable) ⇒ Variable
Returns a new instance of Variable.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/seijaku/variable.rb', line 8 def initialize(variable) @key = variable.first value = variable.last @value = value return unless value.start_with?("$") env_key = value.split("$").last env_value = ENV.fetch(env_key, nil) raise VariableError, "no value set for #{env_key}", [] if env_value.nil? @value = env_value end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/seijaku/variable.rb', line 6 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/seijaku/variable.rb', line 6 def value @value end |