Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplekit-ruby
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sanchez, Paul
simplekit-ruby
Commits
917d9fbf
Commit
917d9fbf
authored
9 years ago
by
pjs
Browse files
Options
Downloads
Patches
Plain Diff
Make EventNotice a struct
parent
8308cc54
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/simplekit.rb
+4
-13
4 additions, 13 deletions
lib/simplekit.rb
with
4 additions
and
13 deletions
lib/simplekit.rb
+
4
−
13
View file @
917d9fbf
...
...
@@ -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 clas
s directly.
class
EventNotice
# This is a private helper
Struct
for the EventScheduler class.
# Users should never try to access
thi
s 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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment