Skip to content
Snippets Groups Projects
Commit 917d9fbf authored by pjs's avatar pjs
Browse files

Make EventNotice a struct

parent 8308cc54
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ module SimpleKit
# at invocation time.
def schedule(event, delay, *args)
fail 'Model scheduled event with negative delay.' if delay < 0
@event_list.push EventNotice.new(event, @model_time + delay, *args)
@event_list.push EventNotice.new(event, @model_time + delay, args)
end
# Start execution of a model. The simulation +model_time+ is
......@@ -79,19 +79,10 @@ module SimpleKit
private
# This is a private helper class for the EventScheduler class.
# Users should never try to access anything in this class directly.
class EventNotice
# This is a private helper Struct for the EventScheduler class.
# Users should never try to access this directly.
EventNotice = Struct.new(:event, :time, *:args) do
include Comparable
attr_reader :event, :time, :args
def initialize(event, time, *args)
@event = event
@time = time
@args = args
end
def <=>(other)
time <=> other.time
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment