Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
TrueClass#|
(untyped obj) -> true
true | object → true
object.c
View on GitHub ↗
static VALUE
true_or(VALUE obj, VALUE obj2)
{
return Qtrue;
}
Returns true:
Example
true | Object.new # => true true | false # => true true | nil # => true
Argument object is evaluated. This is different from true with the short-circuit operator, whose operand is evaluated only if necessary:
Example
true | raise # => Raises RuntimeError. true || raise # => true