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