class NilClass

[edit]

dynamic include: JSON::Generator::GeneratorMethods::NilClass (by json)

要約

nil のクラス。 nil は NilClass クラスの唯一のインスタンスです。 nil は false オブジェクトとともに偽を表し、その他の全てのオブジェクトは真です。

目次

インスタンスメソッド

インスタンスメソッド

self & other -> false[permalink][rdoc][edit]

常に false を返します。

[PARAM] other:
論理積を行なう式です


nil & true  # => false
nil & false # => false
nil & nil   # => false
nil & "a"   # => false
self =~ other -> nil[permalink][rdoc][edit]

右辺に正規表現オブジェクトを置いた正規表現マッチ obj =~ /RE/ をサポートするためのメソッドです。常に nil を返します。

[PARAM] other:
任意のオブジェクトです。結果に影響しません。


obj = 'regexp'
p(obj =~ /re/) #=> 0

obj = nil
p(obj =~ /re/) #=> nil

[SEE_ALSO] String#=~

self ^ other -> bool[permalink][rdoc][edit]

other が真なら true を, 偽なら false を返します。

[PARAM] other:
排他的論理和を行なう式です


nil ^ true  # => true
nil ^ false # => false
nil ^ nil   # => false
nil ^ "a"   # => true
nil? -> bool[permalink][rdoc][edit]

常に true を返します。



nil.nil?   # => true
rationalize -> Rational[permalink][rdoc][edit]
rationalize(eps) -> Rational

0/1 を返します。

[PARAM] eps:
許容する誤差

引数 eps は常に無視されます。



nil.rationalize      # => (0/1)
nil.rationalize(100) # => (0/1)
nil.rationalize(0.1) # => (0/1)
to_a -> Array[permalink][rdoc][edit]

空配列 [] を返します。



nil.to_a   #=> []
to_c -> Complex[permalink][rdoc][edit]

0+0i を返します。



nil.to_c # => (0+0i)
to_f -> Float[permalink][rdoc][edit]

0.0 を返します。



nil.to_f   #=> 0.0
to_h -> {}[permalink][rdoc][edit]

{} を返します。



nil.to_h   #=> {}
to_i -> Integer[permalink][rdoc][edit]

0 を返します。



nil.to_i   #=> 0
to_r -> Rational[permalink][rdoc][edit]

0/1 を返します。



nil.to_r # => (0/1)
to_s -> String[permalink][rdoc][edit]

空文字列 "" を返します。



nil.to_s   # => ""
self | other -> bool[permalink][rdoc][edit]

other が真なら true を, 偽なら false を返します。

[PARAM] other:
論理和を行なう式です


nil | true   # => true
nil | false  # => false
nil | nil    # => false
nil | "a"    # => true