Skip to content

Instantly share code, notes, and snippets.

@kamipo
Created January 3, 2020 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamipo/8c251dfd2c43d2a0c98593b1e7c8223e to your computer and use it in GitHub Desktop.
Save kamipo/8c251dfd2c43d2a0c98593b1e7c8223e to your computer and use it in GitHub Desktop.
class Foo
def initialize(target)
@target = target
end
if RUBY_VERSION > "2.7"
def method_missing(method, *args, **kwargs, &block)
@target.send(method, *args, **kwargs, &block)
end
else
def method_missing(method, *args, &block)
@target.send(method, *args, &block)
end
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment