I'm trying to add an alias to a class method that uses an operator in ruby. My problem is that i would like to keep the new alias with the sintax of the operator
def &(estrategia) does something end
I would like to have the same result doing Myclass.new & estrategia, but like this: Myclass.new with estrategia Is there a way in ruby, to achieve this?
class Trait
def & (strategy)
p "hi #{strategy}"
end
alias with &
end
Trait.new & "John"
Trait.new with "John"