A very simple dream day, but is it possible to define a new logical operator in Ruby using a neat metaprogram trick? I would like to define a but
statement.
For example, if I want to do something, if x
, but not y
true, I should write something like:
if x and not y
But I would like to write
if x but not y
It should work just like and
, but for the programmer to use it wisely to increase the readability of the code.
source share