Skip to content

Commit

Permalink
Merge pull request #13 from rolo9128/master
Browse files Browse the repository at this point in the history
Updated DeferredMethods
  • Loading branch information
rolo9128 authored Mar 29, 2023
2 parents a0b7924 + fc5eee2 commit 87cdbd7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 0.8.2
- Updated DeferredMethods for compatibility with Ruby 3.0 keyword arguments.
# 0.8.1
- Require `redis` gem older than v5.0.
# 0.8
Expand Down
12 changes: 6 additions & 6 deletions lib/maglev/active_job/deferred_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(obj, options)
@options = options
end

def send(name, *args)
def send(name, *args, **kwargs)
options = @options.dup

# if unique options are not set, assume true and set the key to a default
Expand All @@ -22,12 +22,12 @@ def send(name, *args)
options[:unique] = { 'key' => "DeferredMethod:#{@obj.class.name}:#{@obj.id}:#{name}:#{arguments}" }
end

Job.set(options).perform_later(@obj, name, *args)
Job.set(options).perform_later(@obj, name, *args, **kwargs)
end

def method_missing(name, *args)
def method_missing(name, *args, **kwargs)
if @obj.respond_to?(name)
send(name, *args)
send(name, *args, **kwargs)
else
super
end
Expand All @@ -39,7 +39,7 @@ def logger_name
"#{super} object class = #{@object&.class&.name}, method = #{@method}"
end

def perform(object, method, *args)
def perform(object, method, *args, **kwargs)
@object = object
@method = method

Expand All @@ -50,7 +50,7 @@ def perform(object, method, *args)
if ndx < parts.size - 1
path = path.send(part)
else
path.send(part, *args)
path.send(part, *args, **kwargs)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/maglev/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MagLev
VERSION = "0.8.1"
VERSION = "0.8.2"
end

0 comments on commit 87cdbd7

Please sign in to comment.