From 917d9fbf9c534cdc6ec8efdb1563d41312e9e8c8 Mon Sep 17 00:00:00 2001
From: pjs <pjs@alum.mit.edu>
Date: Mon, 21 Dec 2015 14:04:50 -0800
Subject: [PATCH] Make EventNotice a struct

---
 lib/simplekit.rb | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/lib/simplekit.rb b/lib/simplekit.rb
index 7291467..5572fbc 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
-- 
GitLab