Class: Lino::Model::EnvironmentVariable
- Inherits:
-
Object
- Object
- Lino::Model::EnvironmentVariable
- Defined in:
- lib/lino/model/environment_variable.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#quoting ⇒ Object
readonly
Returns the value of attribute quoting.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #array ⇒ Object (also: #to_a)
- #hash ⇒ Object
-
#initialize(name, value, opts = {}) ⇒ EnvironmentVariable
constructor
A new instance of EnvironmentVariable.
- #quoted_value ⇒ Object
- #string ⇒ Object (also: #to_s)
Constructor Details
#initialize(name, value, opts = {}) ⇒ EnvironmentVariable
Returns a new instance of EnvironmentVariable.
12 13 14 15 16 17 |
# File 'lib/lino/model/environment_variable.rb', line 12 def initialize(name, value, opts = {}) opts = with_defaults(opts) @name = name @value = value @quoting = opts[:quoting] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/lino/model/environment_variable.rb', line 8 def name @name end |
#quoting ⇒ Object (readonly)
Returns the value of attribute quoting.
8 9 10 |
# File 'lib/lino/model/environment_variable.rb', line 8 def quoting @quoting end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/lino/model/environment_variable.rb', line 8 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
33 34 35 36 |
# File 'lib/lino/model/environment_variable.rb', line 33 def ==(other) self.class == other.class && state == other.state end |
#array ⇒ Object Also known as: to_a
28 29 30 |
# File 'lib/lino/model/environment_variable.rb', line 28 def array [name.to_s, value.to_s] end |
#hash ⇒ Object
40 41 42 |
# File 'lib/lino/model/environment_variable.rb', line 40 def hash [self.class, state].hash end |
#quoted_value ⇒ Object
19 20 21 |
# File 'lib/lino/model/environment_variable.rb', line 19 def quoted_value "#{quoting}#{value.to_s.gsub(quoting.to_s, "\\#{quoting}")}#{quoting}" end |
#string ⇒ Object Also known as: to_s
23 24 25 |
# File 'lib/lino/model/environment_variable.rb', line 23 def string "#{name}=#{quoted_value}" end |