Sha256: 4e2035736e42d03f2363735a0bc8dbe1856623f700ebc9fce1eae66720ba8c25

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

class Boolean
  def &(other)
    `this.valueOf() ? (other !== false && other !== nil) : false`
  end

  def |(other)
    `this.valueOf() ? true : (other !== false && other !== nil)`
  end

  def ^(other)
    `this.valueOf() ? (other === false || other === nil) : (other !== false && other !== nil)`
  end

  def ==(other)
    `this.valueOf() === other.valueOf()`
  end

  def class
    `this.valueOf() ? #{TrueClass} : #{FalseClass}`
  end

  def to_native
    `this.valueOf()`
  end

  def to_s
    `this.valueOf() ? 'true' : 'false'`
  end
end

class TrueClass
  def self.===(obj)
    `obj === true`
  end
end

class FalseClass
  def self.===(obj)
    `obj === false`
  end
end

TRUE  = true
FALSE = false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.3.15 runtime/corelib/boolean.rb