Sha256: 156c7ff40674c64988941c9f8b72ce2d990464476ef51fe775539d038a4a2d40
Contents?: true
Size: 561 Bytes
Versions: 2
Compression:
Stored size: 561 Bytes
Contents
class Boolean def to_s # Yeah, this is another one for the wtf? collection. As the receiver # is a true or false literal, it is coerced into a Boolean object, # therefore it is always truthy. Therefore we comapre ourself with # true to see if we are actually true or false. We could instead do # `return self.valueOf() ? "true" : "false", but this way seems a # little faster.. `return self == true ? "true" : "false";` end def ==(other) `return self.valueOf() === other.valueOf();` end end TRUE = true FALSE = false
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
opal-0.3.10 | corelib/boolean.rb |
opal-0.3.9 | corelib/boolean.rb |