Class: Ein::Simulator
- Inherits:
-
Object
- Object
- Ein::Simulator
- Defined in:
- lib/ein/simulator.rb
Instance Attribute Summary collapse
-
#current_time ⇒ Object
readonly
Returns the value of attribute current_time.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
-
#initialize(formatter = nil) ⇒ Simulator
constructor
A new instance of Simulator.
- #running? ⇒ Boolean
-
#start ⇒ Object
TODO: should these methods add ! because they modify the simulation ?.
- #stop ⇒ Object
Constructor Details
Instance Attribute Details
#current_time ⇒ Object (readonly)
Returns the value of attribute current_time.
9 10 11 |
# File 'lib/ein/simulator.rb', line 9 def current_time @current_time end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
9 10 11 |
# File 'lib/ein/simulator.rb', line 9 def formatter @formatter end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
9 10 11 |
# File 'lib/ein/simulator.rb', line 9 def world @world end |
Instance Method Details
#running? ⇒ Boolean
31 32 33 |
# File 'lib/ein/simulator.rb', line 31 def running? @running end |
#start ⇒ Object
TODO: should these methods add ! because they modify the simulation ?
19 20 21 22 23 24 |
# File 'lib/ein/simulator.rb', line 19 def start @running = true Thread.abort_on_exception = true Thread.new { run } self end |
#stop ⇒ Object
26 27 28 29 |
# File 'lib/ein/simulator.rb', line 26 def stop @running = false self end |