Casiano
Casiano

Reputation: 491

In Ruby Can I override the ternary operator '?'

In Ruby, Can I override the ternary operator '?'

Upvotes: 2

Views: 231

Answers (1)

Chowlett
Chowlett

Reputation: 46677

No, you can't: ?: is not a method, so you can't redefine it.

This operator precedence table shows which operators are really methods, and hence available to be overridden.

Upvotes: 6

Related Questions