class FalseClass
The global value false is the only instance of class FalseClass and represents a logically false value in boolean expressions. The class provides operators allowing false to participate correctly in logical expressions.
Public Instance Methods
Source
static VALUE
false_and(VALUE obj, VALUE obj2)
{
return Qfalse;
}
Returns false:
false & true # => false false & Object.new # => false
Argument object is evaluated:
false & raise # Raises RuntimeError.
VALUE
rb_obj_equal(VALUE obj1, VALUE obj2)
{
return RBOOL(obj1 == obj2);
}
Returns whether self and other are the same object:
object = Object.new object == object # => true object == Object.new # => false
Here in class Object, ==, equal?, and eql? are the same method. A subclass may override == to provide class-specific meaning.
Unlike ==, the equal? method should never be overridden by subclasses as it is used to determine object identity (that is, a.equal?(b) if and only if a is the same object as b):
obj = "a" other = obj.dup obj == other #=> true obj.equal? other #=> false obj.equal? obj #=> true
The eql? method returns true if obj and other refer to the same hash key. This is used by Hash to test members for equality. For any pair of objects where eql? returns true, the hash value of both objects must be equal. So any subclass that overrides eql? should also override hash appropriately.
For objects of class Object, eql? is synonymous with ==. Subclasses normally continue this tradition by aliasing eql? to their overridden == method, but there are exceptions. Numeric types, for example, perform type conversion across ==, but not across eql?, so:
1 == 1.0 #=> true 1.eql? 1.0 #=> false
(false) → true
(untyped obj) → bool
Source
#define case_equal rb_equal
Returns true or false.
Like Object#==, if other 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.
(false | nil) → false
(untyped obj) → bool
Source
#define false_xor true_and
Returns false if object is nil or false, true otherwise:
nil ^ nil # => false nil ^ false # => false nil ^ Object.new # => true
(nil | false) → false
(untyped obj) → bool
Source
#define false_or true_and
Returns false if object is nil or false, true otherwise:
nil | nil # => false nil | false # => false nil | Object.new # => true
() → "false"
Source
VALUE
rb_false_to_s(VALUE obj)
{
return rb_cFalseClass_to_s;
}
The string representation of false is βfalseβ.