Class: YPetri::World

Inherits:
Object
  • Object
show all
Defined in:
lib/y_petri/world.rb,
lib/y_petri/world/dependency.rb

Overview

Provides basic skeleton for dependency injection for the triples of the parametrized subclasses of Place, Transition and Net in different workspaces.

Defined Under Namespace

Modules: Dependency, PetriNetAspect, SimulationAspect

Instance Method Summary collapse

Constructor Details

#initializeWorld

Returns a new instance of World.


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/y_petri/world.rb', line 18

def initialize
  # Set up parametrized subclasses of Place, Transition, Net.
  param_class!( { Place: YPetri::Place,
                  Transition: YPetri::Transition,
                  Net: YPetri::Net },
                with: { world: self } )
  # Invoke #namespace! method (from YSupport's NameMagic) on each of them.
  # This causes each of them to do bookkeeping of their instances. This is
  # because there is little point in keeping the objects from separate
  # worlds (ie. workspaces) on the same list.
  [ Place(), Transition(), Net() ].each &:namespace!
  # And proceed with initializations (if any) higher in the lookup chain.
  super
end