Sha256: 3aa1eb4d476639dd9de4b8927f9b0450aad24e3c2e11e1cac3cec42cbd33ce2c

Contents?: true

Size: 624 Bytes

Versions: 3

Compression:

Stored size: 624 Bytes

Contents

class Boolean
  `def._isBoolean = true`

  class << self
    undef_method :new
  end

  def &(other)
    `(self == true) ? (other !== false && other !== nil) : false`
  end

  def |(other)
    `(self == true) ? true : (other !== false && other !== nil)`
  end

  def ^(other)
    `(self == true) ? (other === false || other === nil) : (other !== false && other !== nil)`
  end

  def ==(other)
    `(self == true) === other.valueOf()`
  end

  alias equal? ==

  alias singleton_class class

  def to_s
    `(self == true) ? 'true' : 'false'`
  end
end

TrueClass  = Boolean
FalseClass = Boolean

TRUE  = true
FALSE = false

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opal-0.5.5 opal/corelib/boolean.rb
opal-0.5.4 opal/core/boolean.rb
opal-0.5.2 opal/core/boolean.rb