Sha256: d7b2a85fb83d5243b5ddef8c4f0089ec7f932a5914bea01048099b736bfc045a

Contents?: true

Size: 605 Bytes

Versions: 6

Compression:

Stored size: 605 Bytes

Contents

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

  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 singleton_class class

  def to_json
    `(#{self} == true) ? 'true' : 'false'`
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-0.3.37 lib/assets/javascripts/opal/boolean.rb
opal-0.3.36 lib/assets/javascripts/opal/boolean.rb
opal-0.3.35 lib/assets/javascripts/opal/boolean.rb
opal-0.3.34 lib/assets/javascripts/opal/boolean.rb
opal-0.3.33 core/boolean.rb
opal-0.3.32 core/boolean.rb