Method: DiscreteEvent::Events#at_each

Defined in:
lib/discrete_event/events.rb

#at_each(elements, time = nil) {|element| ... } ⇒ nil

Parameters:

  • elements (Enumerable)

    to yield; must be in ascending order according to time; note that this method keeps a reference to this object and removes elements as they are executed, so you may want to pass a copy if you plan to change it after this call returns

  • time (Proc, Symbol, nil) (defaults to: nil)

    used to determine when the action will run for a given element; if a Proc, the proc must return the appropriate time; if a Symbol, each element must respond to time; if nil, it is assumed that element.time returns the time

Yields:

  • (element)

Yield Parameters:

  • element (Object)

    from elements

Returns:

  • (nil)


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