以下の内容はhttps://tbpgr.hatenablog.com/entry/20141001/1412169128より取得しました。


Ruby | Object | nil?

概要

Object#nil? -> bool

詳細

レシーバが nil であれば真を返却。

サンプルコード
class Hoge
  def public_hoge; end
  protected
  def protected_hoge; end
  private
  def private_hoge; end
end

print Hoge.new.nil?.grep /hoge/

出力

$ ruby object_nil.rb
nil.nil?    # => true
NIL.nil?    # => true
hoge.nil?   # => true
'hoge'.nil? # => false
''.nil?     # => false
false.nil?  # => false



以上の内容はhttps://tbpgr.hatenablog.com/entry/20141001/1412169128より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14