Sha256: dccd3fa89d2d95115c54f3fe04515f75ba8a3194749686cd31e9979be520615a

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

class NilClass
  def &(other)
    false
  end

  def |(other)
    `other !== false && other !== nil`
  end

  def ^(other)
    `other !== false && other !== nil`
  end

  def ==(other)
    `other === nil`
  end

  def dup
    raise TypeError
  end

  def inspect
    'nil'
  end

  def nil?
    true
  end

  def singleton_class
    NilClass
  end

  def to_a
    []
  end

  def to_h
    `$opal.hash()`
  end

  def to_i
    0
  end

  alias to_f to_i

  def to_s
    ''
  end

  def object_id
    `#{NilClass}._id || (#{NilClass}._id = $opal.uid())`
  end
  alias hash object_id
end

NIL = nil

Version data entries

3 entries across 3 versions & 1 rubygems

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