lib/y_petri/net/state/feature/firing.rb in y_petri-2.1.9 vs lib/y_petri/net/state/feature/firing.rb in y_petri-2.1.10
- old
+ new
@@ -12,11 +12,19 @@
Hash.new do |hsh, id|
case id
when self then
hsh[ id.transition ]
when ç.net.Transition then
- hsh[ id ] = ç.__new__( id )
+ t = begin
+ ç.net.tS_transitions( [ id ] ).first
+ rescue TypeError => err
+ msg = "Transition #{id} not " +
+ "recognized as tS transition in " +
+ "net #{ç.net}! (%s)"
+ raise TypeError, msg % err
+ end
+ hsh[ id ] = ç.__new__( t )
else
hsh[ ç.net.transition( id ) ]
end
end )
end
@@ -40,10 +48,10 @@
end
def extract_from arg, **nn
case arg
when YPetri::Simulation then
- arg.send( :tS_transitions, [ transition ] ).firing.first
+ arg.send( :tS_transitions, [ transition ] ).first.firing
else
fail TypeError, "Argument type not supported!"
end
end