class Petrinet::MarkingTransitionScript
Public Class Methods
new(source)
click to toggle source
# File lib/petrinet/marking_transition_script.rb, line 3 def initialize(source) @source = source end
Public Instance Methods
marking()
click to toggle source
# File lib/petrinet/marking_transition_script.rb, line 7 def marking pairs = lines.select do |line| line =~ /:\d+\s*$/ end.map do |line| parts = line.split(':') [parts[0].to_sym, parts[1].to_i] end Hash[pairs] end
transitions()
click to toggle source
# File lib/petrinet/marking_transition_script.rb, line 17 def transitions pairs = lines.reject do |line| line =~ /:\d+\s*$/ end.map(&:to_sym) end
Private Instance Methods
lines()
click to toggle source
# File lib/petrinet/marking_transition_script.rb, line 25 def lines @source.split(/\n/) end