class RPetri::Net::DSL
Attributes
net[R]
Public Class Methods
new(net, called_from)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 22 def initialize(net, called_from) @net = net @called_from = called_from @dsl_places_stack = [] @dsl_transitions_stack = [] @dsl_arcs_stack = [] end
Public Instance Methods
finilize()
click to toggle source
# File lib/rpetri/net/dsl.rb, line 42 def finilize @dsl_places_stack.each(&:call) @dsl_transitions_stack.each(&:call) @dsl_arcs_stack.each(&:call) end
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/rpetri/net/dsl.rb, line 30 def method_missing(method, *args, &block) if @called_from.respond_to?(method) @called_from.send(method, *args, &block) else super end end
respond_to_missing?(method, _include_private = false)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 38 def respond_to_missing?(method, _include_private = false) @called_from.respond_to?(method) end
Private Instance Methods
arc(*options, &block)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 58 def arc(*options, &block) @dsl_arcs_stack.push(-> { @net.add_arc(*options, &block) }) end
arcs(items)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 70 def arcs(items) @dsl_arcs_stack.push(-> { @net.add_arcs(items) }) end
place(*options, &block)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 50 def place(*options, &block) @dsl_places_stack.push(-> { @net.add_place(*options, &block) }) end
places(items, tokens = 0)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 62 def places(items, tokens = 0) @dsl_places_stack.push(-> { @net.add_places(items, tokens) }) end
transition(*options, &block)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 54 def transition(*options, &block) @dsl_transitions_stack.push(-> { @net.add_transition(*options, &block) }) end
transitions(items)
click to toggle source
# File lib/rpetri/net/dsl.rb, line 66 def transitions(items) @dsl_transitions_stack.push(-> { @net.add_transitions(items) }) end