Class: PetriNet::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/petri_net/base.rb

Overview

Common structure

Constant Summary collapse

@@object_count =

Global object count.

0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Initialize the base class.



11
12
13
14
# File 'lib/petri_net/base.rb', line 11

def initialize(options = {})
	@logger = Logger.new(STDOUT)
	@logger.level = Logger::INFO
end

Instance Attribute Details

#loggerObject

Accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class.



5
6
7
# File 'lib/petri_net/base.rb', line 5

def logger
  @logger
end

Instance Method Details

#next_object_idObject

Get the next object ID (object count).



17
18
19
# File 'lib/petri_net/base.rb', line 17

def next_object_id
	@@object_count += 1
end

#resetObject

Resets the object-count This should not be used without extreme care It’s made for testing-purposes only



24
25
26
# File 'lib/petri_net/base.rb', line 24

def reset
    @@object_count = 0
end