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
1c381596
Commit
1c381596
authored
5 years ago
by
pjs
Browse files
Options
Downloads
Patches
Plain Diff
Handle varargs w/o deprecation warnings in 2.7+
parent
b72ce230
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
+5
-4
5 additions, 4 deletions
lib/simplekit.rb
with
5 additions
and
4 deletions
lib/simplekit.rb
+
5
−
4
View file @
1c381596
...
...
@@ -54,7 +54,7 @@ module SimpleKit
# - +args+ -> zero or more named arguments to pass to the event
# at invocation time. These should be specified with labels, and
# consequently they can be placed in any order.
def
schedule
(
event
,
delay
,
**
args
)
def
schedule
(
event
,
delay
,
args
=
{}
)
raise
'Model scheduled event with negative delay.'
if
delay
<
0
@event_list
.
push
EventNotice
.
new
(
event
,
@model_time
,
delay
,
args
)
end
...
...
@@ -65,9 +65,10 @@ module SimpleKit
# all be a match with the corresponding +args+ of the scheduled event
# in order for the cancellation to apply, but +args+ which are not
# specified do not affect the target event matching.
def
cancel
(
event
,
**
args
)
def
cancel
(
event
,
args
=
{}
)
@cancel_set
[
event
]
||=
Set
.
new
@cancel_set
[
event
].
add
(
args
.
empty?
?
nil
:
args
)
# @cancel_set[event].add(args.empty? ? nil : args)
@cancel_set
[
event
].
add
(
args
)
end
# Cancel all currently scheduled events of type +event+.
...
...
@@ -96,7 +97,7 @@ module SimpleKit
if
current_event
.
args
.
empty?
@user_model
.
send
(
current_event
.
event
)
else
@user_model
.
send
(
current_event
.
event
,
current_event
.
args
)
@user_model
.
send
(
current_event
.
event
,
**
current_event
.
args
)
end
end
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