Class: Chemtrail::Parameter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#fieldsObject



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

def fields
  @fields ||= {}
end

#to_hashObject



20
21
22
23
24
25
26
# File 'lib/chemtrail/parameter.rb', line 20

def to_hash
  {
    id => {
      "Type" => type
    }.merge(fields)
  }
end

#to_referenceObject



14
15
16
17
18
# File 'lib/chemtrail/parameter.rb', line 14

def to_reference
  {
    "Ref" => id
  }
end