Class: Chemtrail::Parameter
- Inherits:
-
Object
- Object
- Chemtrail::Parameter
- Defined in:
- lib/chemtrail/parameter.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(id, type, fields = {}) ⇒ Parameter
constructor
A new instance of Parameter.
- #to_hash ⇒ Object
- #to_reference ⇒ Object
Constructor Details
#initialize(id, type, fields = {}) ⇒ Parameter
Returns a new instance of Parameter.
4 5 6 7 8 |
# File 'lib/chemtrail/parameter.rb', line 4 def initialize(id, type, fields = {}) @id = id @type = type @fields = fields end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/chemtrail/parameter.rb', line 2 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/chemtrail/parameter.rb', line 2 def type @type end |
Instance Method Details
#fields ⇒ Object
10 11 12 |
# File 'lib/chemtrail/parameter.rb', line 10 def fields @fields ||= {} end |
#to_hash ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/chemtrail/parameter.rb', line 20 def to_hash { id => { "Type" => type }.merge(fields) } end |
#to_reference ⇒ Object
14 15 16 17 18 |
# File 'lib/chemtrail/parameter.rb', line 14 def to_reference { "Ref" => id } end |