Reputation: 1616
What is the name of the method corresponding to the ternary operator? By name I mean :+ for addition, :== for equality, etc.
I want to override the ternary operator to build a proxy class (same idea as Javascript proxies) but I can't seem to find the name for this.
Upvotes: 0
Views: 117
Reputation: 11323
There are two names that this is known by, if you are talking about the ? :
operator, and that is ternary operator or conditional operator.
But it is not a method, as you can see in this table.
You would need to go to Ruby Source itself to override the behavior. Probably not what you would want to do.
Upvotes: 3
Reputation: 1802
I'm pretty sure it's just known as the ternary operator. Usually people know what you mean when you say that, and I've never heard or seen another name, even during research.
Upvotes: 1