Skip to content

Instantly share code, notes, and snippets.

@etscrivner
Created June 19, 2017 19:48
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 etscrivner/6bed7d44852746d7d851d1a6ea86a252 to your computer and use it in GitHub Desktop.
Save etscrivner/6bed7d44852746d7d851d1a6ea86a252 to your computer and use it in GitHub Desktop.
Ruby propagates arguments up to super method calls for you
class Parent
def try_me(confirmed_only: true)
confirmed_only
end
end
class Child < Parent
def try_me(confirmed_only: true)
# Ruby will proxy the value of `confirmed_only` up to the super method invocation for you.
super
end
end
# Result: `false`
puts Child.new.try_me(confirmed_only: false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment