Sha256: b2dc75fad7763632270fdca51059806f7822256c43e3b2b62fb4ef600d5ebe2b

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

class Boolean < `Boolean`
  %x{
    Boolean_prototype._isBoolean = true;
  }

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

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

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

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

  alias singleton_class class

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

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

TRUE  = true
FALSE = false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.3.20 core/boolean.rb