Method: Petri::Transition#produce

Defined in:
lib/petri/transition.rb

#produce(label, options = {}) ⇒ Object

Raises:

  • (TypeError)


34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/petri/transition.rb', line 34

def produce(label, options={})
  @net.add_place(label, options)
  raise TypeError unless (options[:with_guard].is_a? Symbol or options[:with_guard].nil?)
  guard = options[:with_guard]

  @production << {label: label, guard: guard} if label.is_a? Symbol
  if label.is_a? Array
    for place in label
      raise TypeError unless place.is_a? Symbol
      @production << {label: label, guard: guard}
    end
  end
end