Module: DiscreteEvent::Events
- Defined in:
- lib/discrete_event/events.rb
Overview
Mix-in for simulations with multiple objects that have to share the same clock. See the README for an example.
The implementing class must have an instance method event_queue
that returns the EventQueue to use; this method may be private.
Instance Method Summary collapse
- #after(delay) { ... } ⇒ nil
- #at(time) { ... } ⇒ nil
- #at_each(elements, time = nil) {|element| ... } ⇒ nil
- #every(interval, start = 0, &action) ⇒ nil
- #now ⇒ Number
- #recur_after(interval) ⇒ nil
Instance Method Details
permalink #after(delay) { ... } ⇒ nil
[View source]
32 33 34 |
# File 'lib/discrete_event/events.rb', line 32 def after delay, &action event_queue.after(delay, &action) end |
permalink #at(time) { ... } ⇒ nil
[View source]
19 20 21 |
# File 'lib/discrete_event/events.rb', line 19 def at time, &action event_queue.at(time, &action) end |
permalink #at_each(elements, time = nil) {|element| ... } ⇒ nil
[View source]
57 58 59 |
# File 'lib/discrete_event/events.rb', line 57 def at_each elements, time=nil, &action event_queue.at_each(elements, time, &action) end |
permalink #every(interval, start = 0, &action) ⇒ nil
[View source]
80 81 82 |
# File 'lib/discrete_event/events.rb', line 80 def every interval, start=0, &action event_queue.every(interval, start, &action) end |
permalink #now ⇒ Number
[View source]
89 90 91 |
# File 'lib/discrete_event/events.rb', line 89 def now event_queue.now end |
permalink #recur_after(interval) ⇒ nil
[View source]
68 69 70 |
# File 'lib/discrete_event/events.rb', line 68 def recur_after interval event_queue.recur_after(interval) end |