In a Ruby Class I overwrite three methods, and, in each method, I basically do the same thing:
class ExampleClass
def confirmation_required?
is_allowed && super
end
def postpone_email_change?
is_allowed && super
end
def reconfirmation_required?
is_allowed && super
end
end
Is there a more compact syntax? How can I shorten the code?
How about to use alias?
class ExampleClass
def confirmation_required?
is_allowed && super
end
alias postpone_email_change? confirmation_required?
alias reconfirmation_required? confirmation_required?
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With