Class: FalseClass
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | object.c, golf_prelude.rb, object.c |
Overview
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.
Instance Method Summary
-
#&(object) ⇒ false
Alias for NilClass#&.
-
#==(other) ⇒ Boolean
Alias for TrueClass#==.
- #===
- #^
-
#inspect
Alias for #to_s.
- #old_to_s
- #to_s (also: #inspect)
- #|
Instance Method Details
#&(object) ⇒ false
#&(object) ⇒ false
false
#&(object) ⇒ false
Alias for NilClass#&.
#==(other) ⇒ Boolean
Alias for TrueClass#==. 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
#===
[ GitHub ]#^
[ GitHub ]#inspect
Alias for #to_s.
#old_to_s
[ GitHub ]# File 'golf_prelude.rb', line 77
alias old_to_s to_s
#to_s Also known as: #inspect
[ GitHub ]# File 'golf_prelude.rb', line 78
def to_s "" end