Class: Petri::Place

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, options = {}) ⇒ Place

Returns a new instance of Place.

Raises:

  • (TypeError)


3
4
5
6
7
8
9
10
11
# File 'lib/petri/place.rb', line 3

def initialize(label, options={})
  raise TypeError unless label.is_a? Symbol

  name = options[:name] || label.to_s
  raise TypeError unless name.is_a? String

  @label = label
  @name = name
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



2
3
4
# File 'lib/petri/place.rb', line 2

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/petri/place.rb', line 2

def name
  @name
end

Instance Method Details

#compileObject



13
14
15
16
17
18
# File 'lib/petri/place.rb', line 13

def compile
  {
    label: @label,
    name: @name,
  }
end

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


20
21
22
23
# File 'lib/petri/place.rb', line 20

def eql?(other)
  return @label == other.label if other.is_a? Petri::Place
  false
end