Class: Chemtrail::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/chemtrail/output.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



2
3
4
# File 'lib/chemtrail/output.rb', line 2

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/chemtrail/output.rb', line 2

def id
  @id
end

#valueObject (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_hashObject



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_hashObject



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_parameterObject



10
11
12
# File 'lib/chemtrail/output.rb', line 10

def value_parameter
  Chemtrail::ReferencePresenter.new(value).to_parameter
end