Skip to content

Commit

Permalink
Fix on Ruby 3
Browse files Browse the repository at this point in the history
  • Loading branch information
mlarraz committed Jan 14, 2021
1 parent 4ff8cd5 commit 253a6b8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/makara/connection_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,18 @@ def execute(*args)
end

# we want to forward all private methods, since we could have kicked out from a private scenario
def method_missing(m, *args, &block)
if _makara_connection.respond_to?(m)
_makara_connection.public_send(m, *args, &block)
else # probably private method
_makara_connection.__send__(m, *args, &block)
if RUBY_VERSION >= "2.7.0"
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def method_missing(...)
_makara_connection.send(...)
end
RUBY
else
def method_missing(m, *args, &block)
_makara_connection.send(m, *args, &block)
end
end


class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def respond_to#{RUBY_VERSION.to_s =~ /^1.8/ ? nil : '_missing'}?(m, include_private = false)
_makara_connection.respond_to?(m, true)
Expand Down

0 comments on commit 253a6b8

Please sign in to comment.