Class: FlowCore::Definition::Place

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_core/definition/place.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, attributes = {}) ⇒ Place

Returns a new instance of Place.

Raises:

  • (TypeError)


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

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/flow_core/definition/place.rb', line 5

def attributes
  @attributes
end

#tagObject (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

#compileObject



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: ==

Returns:

  • (Boolean)


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