Class: FlowCore::Definition::Place
- Inherits:
-
Object
- Object
- FlowCore::Definition::Place
- Defined in:
- lib/flow_core/definition/place.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #compile ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(tag, attributes = {}) ⇒ Place
constructor
A new instance of Place.
Constructor Details
#initialize(tag, attributes = {}) ⇒ Place
Returns a new instance of Place.
7 8 9 10 11 12 13 14 |
# File 'lib/flow_core/definition/place.rb', line 7 def initialize(tag, attributes = {}) raise TypeError unless tag.is_a? Symbol @tag = tag @attributes = attributes.with_indifferent_access.except(FlowCore::Place::FORBIDDEN_ATTRIBUTES) @attributes[:name] ||= tag.to_s @attributes[:tag] ||= tag.to_s end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/flow_core/definition/place.rb', line 5 def attributes @attributes end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
5 6 7 |
# File 'lib/flow_core/definition/place.rb', line 5 def tag @tag end |
Instance Method Details
#compile ⇒ Object
16 17 18 19 20 21 |
# File 'lib/flow_core/definition/place.rb', line 16 def compile { tag: @tag, attributes: @attributes } end |
#eql?(other) ⇒ Boolean Also known as: ==
23 24 25 26 27 28 29 |
# File 'lib/flow_core/definition/place.rb', line 23 def eql?(other) if other.is_a? FlowCore::Definition::Place @tag == other.tag else false end end |