るりまサーチ

最速Rubyリファレンスマニュアル検索!
967件ヒット [101-200件を表示] (0.012秒)

別のキーワード

  1. _builtin <=
  2. bigdecimal <=
  3. float <=
  4. module <=
  5. complex <=

クラス

モジュール

検索結果

<< < 1 2 3 4 ... > >>

BigDecimal#<=>(other) -> -1 | 0 | 1 | nil (6100.0)

self が other より大きい場合に 1 を、等しい場合に 0 を、小さい場合には -1 をそれぞれ返します。

self が other より大きい場合に 1 を、等しい場合に 0 を、小さい場合には
-1 をそれぞれ返します。

self と other が比較できない場合には nil を返します。

Bignum#<=>(other) -> Fixnum | nil (6100.0)

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

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

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

1 <=> 2 #=> -1
1 <=> 1 #=> 0
2 <=> 1 #=> 1...

Complex#<=>(other) -> -1 | 0 | 1 | nil (6100.0)

self の虚部がゼロで other が実数の場合、 self の実部の <=> メソッドで other と比較した結果を返します。 other が Complex で虚部がゼロの場合も同様です。

... <=> メソッドで other と比較した結果を返します。
other が Complex で虚部がゼロの場合も同様です。

その他の場合は nil を返します。

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

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

Date#<=>(other) -> -1 | 0 | 1 | nil (6100.0)

二つの日付を比較します。 同じ日付なら 0 を、self が other よりあとの日付なら 1 を、 その逆なら -1 を返します。

...equire "date"

p Date.new(2001, 2, 3) <=> Date.new(2001, 2, 4) # => -1
p Date.new(2001, 2, 3) <=> Date.new(2001, 2, 3) # => 0
p Date.new(2001, 2, 3) <=> Date.new(2001, 2, 2) # => 1
p Date.new(2001, 2, 3) <=> Object.new # => nil
p Date.new(2001, 2, 3) <=> Rational(4903887, 2) # => 0
//}

@p...

Fiddle::Pointer#<=>(other) -> Integer (6100.0)

ポインタの指すアドレスの大小を比較します。

ポインタの指すアドレスの大小を比較します。

other より小さい場合は -1, 等しい場合は 0、other より大きい場合は
1を返します。

@param other 比較対象の Pointer オブジェクト

絞り込み条件を変える

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

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

...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
//}...

Fixnum#<=>(other) -> Fixnum (6100.0)

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

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

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

1 <=> 2 #=> -1
1 <=> 1 #=> 0
2 <=> 1 #=> 1...

Float#<=>(other) -> -1 | 0 | 1 | nil (6100.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
//}...

Gem::Dependency#<=>(other) -> Integer (6100.0)

self と other を Gem::Dependency#name の ASCII コードで比較して self が大きい時には正の整数、等しい時には 0、小さい時には負の整数を返します。

self と other を Gem::Dependency#name の ASCII コードで比較して
self が大きい時には正の整数、等しい時には 0、小さい時には負の整数を返します。

Gem::Version#<=>(other) -> -1 | 0 | 1 | nil (6100.0)

self と other を比較して、self が小さい時に -1、 等しい時に 0、大きい時に 1 の整数を返します。 また、other が Gem::Version ではなく比較できないとき、 nil を返します。

...//emlist[][ruby]{
p Gem::Version.new("3.9.0") <=> Gem::Version.new("3.10.0") # => -1
p Gem::Version.new("3.0.0") <=> Gem::Version.new("3.0.0") # => 0
p Gem::Version.new("3.0.0") <=> Gem::Version.new("3.0") # => 0

p Gem::Version.new("3.9.0") <=> "3.9.0" # => nil
//}

@param other 比較対...

絞り込み条件を変える

IPAddr#<=>(other) -> Integer | nil (6100.0)

self と other を比較します。

...の IPAddr オブジェクト。

@return self と other のアドレスファミリが一致しない場合は nil を返します。
アドレスファミリが一致する場合は、両方の数値表現を Integer#<=>
で比較した結果を返します。

@see Integer#<=>...
<< < 1 2 3 4 ... > >>