Sha256: c555bad54fd1d8612c7a4b078e48e9926c6528bd6409170d1a54acbce287d281

Contents?: true

Size: 950 Bytes

Versions: 16

Compression:

Stored size: 950 Bytes

Contents

class ::NilClass
  `self.$$prototype.$$meta = #{self}`

  class << self
    def allocate
      ::Kernel.raise ::TypeError, "allocator undefined for #{name}"
    end

    undef :new
  end

  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
    nil
  end

  def clone(freeze: true)
    nil
  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

  def to_s
    ''
  end

  def to_c
    ::Complex.new(0, 0)
  end

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

  def to_r
    ::Kernel.Rational(0, 1)
  end

  def instance_variables
    []
  end

  alias to_f to_i
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
opal-1.7.4 opal/corelib/nil.rb
opal-1.7.3 opal/corelib/nil.rb
opal-1.7.2 opal/corelib/nil.rb
opal-1.7.1 opal/corelib/nil.rb
opal-1.7.0 opal/corelib/nil.rb
opal-1.7.0.rc1 opal/corelib/nil.rb
opal-1.6.1 opal/corelib/nil.rb
opal-1.6.0 opal/corelib/nil.rb
opal-1.6.0.rc1 opal/corelib/nil.rb
opal-1.6.0.alpha1 opal/corelib/nil.rb
opal-1.5.1 opal/corelib/nil.rb
opal-1.5.0 opal/corelib/nil.rb
opal-1.5.0.rc1 opal/corelib/nil.rb
opal-1.4.1 opal/corelib/nil.rb
opal-1.4.0 opal/corelib/nil.rb
opal-1.4.0.alpha1 opal/corelib/nil.rb