Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.