The class of the singleton object true.
Several of its methods act as operators:
-
#&
-
#|
-
#^
One other method:
Instance Public methods
true & object → true or false Link
Returns false if object is false or nil, true otherwise:
true & Object.new # => true true & false # => false true & nil # => false
Source: show
static VALUE
true_and(VALUE obj, VALUE obj2)
{
return RBOOL(RTEST(obj2));
}
true === other → true or false
false === other → true or false
nil === other → true or false
Link
Returns true or false.
Like Object#==, if object is an instance of Object (and not an instance of one of its many subclasses).
This method is commonly overridden by those subclasses, to provide meaningful semantics in case statements.
Source: show
#define case_equal rb_equal
true ^ object → !object Link
Returns true if object is false or nil, false otherwise:
true ^ Object.new # => false
true ^ false # => true
true ^ nil # => true
Source: show
static VALUE
true_xor(VALUE obj, VALUE obj2)
{
return rb_obj_not(obj2);
}
true.to_s → 'true' Link
Source: show
VALUE
rb_true_to_s(VALUE obj)
{
return rb_cTrueClass_to_s;
}
true | object → true Link
Returns true:
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:
true | raise # => Raises RuntimeError.
true || raise # => true
Source: show
static VALUE
true_or(VALUE obj, VALUE obj2)
{
return Qtrue;
}