diff --git a/lib/simplekit.rb b/lib/simplekit.rb index 7291467fddc109407a0a50a87c777144cdaebaf4..5572fbcf0102c68c8f2178be4099d2473af49bf6 100644 --- a/lib/simplekit.rb +++ b/lib/simplekit.rb @@ -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