Class: Chemtrail::Output
- Inherits:
-
Object
- Object
- Chemtrail::Output
- Defined in:
- lib/chemtrail/output.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #description_hash ⇒ Object
-
#initialize(id, value, description = nil) ⇒ Output
constructor
A new instance of Output.
- #to_hash ⇒ Object
- #value_parameter ⇒ Object
Constructor Details
#initialize(id, value, description = nil) ⇒ Output
Returns a new instance of Output.
4 5 6 7 8 |
# File 'lib/chemtrail/output.rb', line 4 def initialize(id, value, description = nil) @id = id @value = value @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
2 3 4 |
# File 'lib/chemtrail/output.rb', line 2 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/chemtrail/output.rb', line 2 def id @id end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
2 3 4 |
# File 'lib/chemtrail/output.rb', line 2 def value @value end |
Instance Method Details
#description_hash ⇒ Object
14 15 16 17 18 |
# File 'lib/chemtrail/output.rb', line 14 def description_hash hash = {} hash["Description"] = description unless description.nil? hash end |
#to_hash ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/chemtrail/output.rb', line 20 def to_hash { id => { "Value" => value_parameter }.merge(description_hash) } end |
#value_parameter ⇒ Object
10 11 12 |
# File 'lib/chemtrail/output.rb', line 10 def value_parameter Chemtrail::ReferencePresenter.new(value).to_parameter end |