vendredi 20 janvier 2017

Overwrite similar methods, shorter syntax

In a Ruby Class I overwrite 3 methods. As you can see in each method I basically do the same:

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? Thanks

Aucun commentaire:

Enregistrer un commentaire