るりまサーチ

最速Rubyリファレンスマニュアル検索!
23940件ヒット [1-100件を表示] (0.128秒)

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

NilClass#nil? -> bool (21213.0)

常に true を返します。

...常に true を返します。

//emlist[例][ruby]{
nil
.nil? # => true
//}...

Module#>(other) -> bool | nil (18249.0)

比較演算子。 self が other の先祖である場合、true を返します。 self が other の子孫か同一クラスである場合、false を返します。

...ます。
self が other の子孫か同一クラスである場合、false を返します。

継承関係にないクラス同士の比較では
nil
を返します。

@param other 比較対象のモジュールやクラス

@raise TypeError other がクラスやモジュールではない場合...
...nded
prepend Awesome
end

Included.ancestors # => [Included, Awesome]
Awesome > Included # => true
Included > Awesome # => false

Prepended.ancestors # => [Awesome, Prepended]
Awesome > Prepended # => true
Prepended > Awesome # => false

Awesome > Awesome # => false
Awesome > Object # => nil
//}...

Object#nil? -> bool (18235.0)

レシーバが nil であれば真を返します。

...レシーバが nil であれば真を返します。

p false.nil? #=> false
p nil.nil? #=> true

@see NilClass...

Comparable#>(other) -> bool (18118.0)

比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が正の整数を返した場合に、true を返します。 それ以外の整数を返した場合に、false を返します。

...=> をもとにオブジェクト同士を比較します。
<=> が正の整数を返した場合に、true を返します。
それ以外の整数を返した場合に、false を返します。

@param other 自身と比較したいオブジェクトを指定します。
@raise ArgumentError <=>...
... nil を返したときに発生します。

//emlist[例][ruby]{
1 > 0 # => true
1 > 1 # => false
//}...

Object::NIL -> NilClass (6335.0)

非推奨です。 nil と同じ。

...非推奨です。 nil と同じ。

この定数は過去との互換性のために提供されています。擬似変数 nil を使ってください。

Ruby では false と nil が偽として扱われます。
偽でない値(false でも nil でもない値) は全て真とみなされま...

絞り込み条件を変える

MiniTest::Assertions#assert_nil(object, message = nil) -> true (6324.0)

与えられたオブジェクトが nil である場合、検査にパスしたことになります。

...与えられたオブジェクトが nil である場合、検査にパスしたことになります。

@param object 任意のオブジェクトを指定します。

@param message 検査に失敗した場合に表示するメッセージを指定します。
文字列か Proc...
...を指定します。Proc である場合は Proc#call した
結果を使用します。

@raise MiniTest::Assertion 与えられたオブジェクトが nil でない場合に発生します。...

Rational#<=>(other) -> -1 | 0 | 1 | nil (6235.0)

self と other を比較して、self が大きい時に 1、等しい時に 0、小さい時に -1 を返します。比較できない場合はnilを返します。

...nilを返します。

@param other 自身と比較する数値

@return -1 か 0 か 1 か nil を返します。

//emlist[例][ruby]{
Rational(2, 3) <=> Rational(2, 3) # => 0
Rational(5) <=> 5 # => 0
Rational(2, 3) <=> Rational(1,3) # => 1
Rational(1, 3) <=> 1...
...# => -1
Rational(1, 3) <=> 0.3 # => 1
Rational(1, 3) <=> nil # => nil
//}...

Module#<=>(other) -> Integer | nil (6231.0)

self と other の継承関係を比較します。

...
nil
を返します。

other がクラスやモジュールでなければ
nil
を返します。

@param other 比較対象のクラスやモジュール

//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar <=> Foo # => -1
p Baz <=> Bar...
...# => -1
p Baz <=> Foo # => -1
p Baz <=> Qux # => nil
p Qux <=> Baz # => nil

p Baz <=> Object.new # => nil
//}...

Float#<=>(other) -> -1 | 0 | 1 | nil (6229.0)

self と other を比較して、self が大きい時に正、 等しい時に 0、小さい時に負の整数を返します。 比較できない場合はnilを返します

...self が大きい時に正、
等しい時に 0、小さい時に負の整数を返します。
比較できない場合はnilを返します

//emlist[例][ruby]{
3.05 <=> 3.14 # => -1
1.732 <=> 1.414 # => 1
3.3 - 3.3 <=> 0.0 # => 0
3.14 <=> "hoge" # => nil
3.14 <=> 0.0/0.0 # => nil
//}...

Integer#<=>(other) -> -1 | 0 | 1 | nil (6229.0)

self と other を比較して、self が大きい時に1、等しい時に 0、小さい時 に-1、比較できない時に nil を返します。

...、self が大きい時に1、等しい時に 0、小さい時
に-1、比較できない時に nil を返します。

@param other 比較対象の数値
@return -1 か 0 か 1 か nil のいずれか

//emlist[][ruby]{
1 <=> 2 # => -1
1 <=> 1 # => 0
2 <=> 1 # => 1
2 <=> '' # => nil
//}...

絞り込み条件を変える

Object#must_be_nil -> true (6229.0)

自身が nil である場合、検査にパスしたことになります。

...自身が nil である場合、検査にパスしたことになります。

@raise MiniTest::Assertion 自身が nil でない場合に発生します。

@see MiniTest::Assertions#assert_nil...

File::Stat#<=>(o) -> Integer | nil (6223.0)

ファイルの最終更新時刻を比較します。self が other よりも 新しければ正の数を、等しければ 0 を古ければ負の数を返します。 比較できない場合は nil を返します。

... nil を返します。

@param o File::Stat のインスタンスを指定します。

//emlist[][ruby]{
require 'tempfile' # for Tempfile

fp1 = Tempfile.open("first")
fp1.print "古い方\n"
sleep(1)
fp2 = Tempfile.open("second")
fp2.print "新しい方\n"

p File::Stat.new(fp1.path) <=> File...
...::Stat.new(fp2.path) #=> -1
p File::Stat.new(fp2.path) <=> File::Stat.new(fp1.path) #=> 1
p File::Stat.new(fp1.path) <=> fp2.path #=> nil
//}...
<< 1 2 3 ... > >>