Class: Habdsl::Model::Point
- Inherits:
-
Object
- Object
- Habdsl::Model::Point
- Defined in:
- lib/habdsl/model/point.rb
Overview
Represents a point in the model.
Instance Attribute Summary collapse
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #equipment ⇒ Object
-
#initialize(name:, label:, type:, icon:, tags:, parent: nil, channel: nil) ⇒ Point
constructor
A new instance of Point.
- #location ⇒ Object
- #to_s(parent_name = nil) ⇒ Object
Constructor Details
#initialize(name:, label:, type:, icon:, tags:, parent: nil, channel: nil) ⇒ Point
Returns a new instance of Point.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/habdsl/model/point.rb', line 9 def initialize(name:, label:, type:, icon:, tags:, parent: nil, channel: nil) validate!(name, "name") validate!(type, "type") validate!(icon, "icon") @name = name @label = label @type = type @icon = icon @tags = @parent = parent @channel = channel end |
Instance Attribute Details
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
7 8 9 |
# File 'lib/habdsl/model/point.rb', line 7 def icon @icon end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/habdsl/model/point.rb', line 7 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/habdsl/model/point.rb', line 7 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
7 8 9 |
# File 'lib/habdsl/model/point.rb', line 7 def parent @parent end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
7 8 9 |
# File 'lib/habdsl/model/point.rb', line 7 def @tags end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/habdsl/model/point.rb', line 7 def type @type end |
Instance Method Details
#equipment ⇒ Object
27 28 29 |
# File 'lib/habdsl/model/point.rb', line 27 def equipment(*) raise "Error: equipment cannot be nested inside point" end |
#location ⇒ Object
23 24 25 |
# File 'lib/habdsl/model/point.rb', line 23 def location(*) raise "Error: location cannot be nested inside point" end |
#to_s(parent_name = nil) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/habdsl/model/point.rb', line 31 def to_s(parent_name = nil) result = "#{@type} #{@name} \"#{@label}\" <#{@icon}>" result += format_parent(parent_name, @parent) result += " [#{@tags.map {|t| "\"#{t}\"" }.join(', ')}]" result += " {channel=\"#{@channel}\"}" if @channel result += "\n" result end |