Sha256: e057542718764d462e80cb18ee9454f61cd800cc50f0d25cb8faf2804f5bc7af

Contents?: true

Size: 847 Bytes

Versions: 21

Compression:

Stored size: 847 Bytes

Contents

class NilClass
  `def.$$meta = #{self}`

  def !
    true
  end

  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, "can't dup #{self.class}"
  end

  def clone
    raise TypeError, "can't clone #{self.class}"
  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 to_c
    Complex.new(0, 0)
  end

  def rationalize(*args)
    raise ArgumentError if args.length > 1
    Rational(0, 1)
  end

  def to_r
    Rational(0, 1)
  end

  def instance_variables
    []
  end
end

NIL = nil

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
opal-0.10.6 opal/corelib/nil.rb
opal-0.10.6.beta opal/corelib/nil.rb
opal-0.10.5 opal/corelib/nil.rb
opal-0.10.4 opal/corelib/nil.rb
opal-0.11.0.rc1 opal/corelib/nil.rb
opal-0.10.3 opal/corelib/nil.rb
opal-0.10.2 opal/corelib/nil.rb
opal-0.10.1 opal/corelib/nil.rb
opal-0.10.0 opal/corelib/nil.rb
opal-0.10.0.rc2 opal/corelib/nil.rb
opal-0.9.4 opal/corelib/nil.rb
opal-0.9.3 opal/corelib/nil.rb
opal-0.10.0.rc1 opal/corelib/nil.rb
opal-0.10.0.beta5 opal/corelib/nil.rb
opal-0.10.0.beta4 opal/corelib/nil.rb
opal-0.10.0.beta3 opal/corelib/nil.rb
opal-0.10.0.beta2 opal/corelib/nil.rb
opal-0.10.0.beta1 opal/corelib/nil.rb
opal-0.9.2 opal/corelib/nil.rb
opal-0.9.0 opal/corelib/nil.rb