Sha256: 48a128a76774073d14e80de8c62a295a4289836c5a7b7ed4dcfb059a44b2824d

Contents?: true

Size: 915 Bytes

Versions: 18

Compression:

Stored size: 915 Bytes

Contents

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

  class << self
    def allocate
      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

  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

18 entries across 18 versions & 1 rubygems

Version Path
opal-1.3.2 opal/corelib/nil.rb
opal-1.3.1 opal/corelib/nil.rb
opal-1.3.0 opal/corelib/nil.rb
opal-1.3.0.rc1 opal/corelib/nil.rb
opal-1.3.0.alpha1 opal/corelib/nil.rb
opal-1.2.0 opal/corelib/nil.rb
opal-1.2.0.beta1 opal/corelib/nil.rb
opal-1.1.1 opal/corelib/nil.rb
opal-1.1.1.rc1 opal/corelib/nil.rb
opal-1.1.0 opal/corelib/nil.rb
opal-1.1.0.rc1 opal/corelib/nil.rb
opal-1.0.5 opal/corelib/nil.rb
opal-1.0.4 opal/corelib/nil.rb
opal-1.0.3 opal/corelib/nil.rb
opal-1.0.2 opal/corelib/nil.rb
opal-1.0.1 opal/corelib/nil.rb
opal-1.0.0 opal/corelib/nil.rb
opal-1.0.0.beta1 opal/corelib/nil.rb