Sha256: dc8955a5cfdf425320b4b3d5c6cb66a10b262fc7f23d7059898b4dfe982bf0a0

Contents?: true

Size: 1.76 KB

Versions: 7

Compression:

Stored size: 1.76 KB

Contents

# The class of the singleton object `nil`.
#
class NilClass
  public

  # And---Returns `false`. *obj* is always evaluated as it is the argument to a
  # method call---there is no short-circuit evaluation in this case.
  #
  def &: (untyped obj) -> bool

  # Case Equality -- For class Object, effectively the same as calling `#==`, but
  # typically overridden by descendants to provide meaningful semantics in `case`
  # statements.
  #
  def ===: (nil) -> true
         | (untyped obj) -> bool

  # Dummy pattern matching -- always returns nil.
  #
  def =~: (untyped obj) -> nil

  # Exclusive Or---If *obj* is `nil` or `false`, returns `false`; otherwise,
  # returns `true`.
  #
  def ^: (nil) -> false
       | (false) -> false
       | (untyped obj) -> bool

  # Always returns the string "nil".
  #
  def inspect: () -> "nil"

  # Only the object *nil* responds `true` to `nil?`.
  #
  def nil?: () -> bool

  # Returns zero as a rational.  The optional argument `eps` is always ignored.
  #
  def rationalize: (?untyped eps) -> Rational

  # Always returns an empty array.
  #
  #     nil.to_a   #=> []
  #
  def to_a: () -> [ ]

  # Returns zero as a complex.
  #
  def to_c: () -> Complex

  # Always returns zero.
  #
  #     nil.to_f   #=> 0.0
  #
  def to_f: () -> Float

  # Always returns an empty hash.
  #
  #     nil.to_h   #=> {}
  #
  def to_h: () -> ::Hash[untyped, untyped]

  # Always returns zero.
  #
  #     nil.to_i   #=> 0
  #
  def to_i: () -> 0

  # Returns zero as a rational.
  #
  def to_r: () -> Rational

  # Always returns the empty string.
  #
  def to_s: () -> ""

  # Or---Returns `false` if *obj* is `nil` or `false`; `true` otherwise.
  #
  def |: (nil) -> false
       | (false) -> false
       | (untyped obj) -> bool

  def clone: (?freeze: true?) -> self
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rbs-2.0.0 core/nil_class.rbs
rbs-2.0.0.pre2 core/nil_class.rbs
rbs-2.0.0.pre1 core/nil_class.rbs
rbs-1.8.1 core/nil_class.rbs
rbs-1.8.0 core/nil_class.rbs
rbs-1.7.1 core/nil_class.rbs
rbs-1.7.0 core/nil_class.rbs