るりまサーチ

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

別のキーワード

  1. _builtin <=>
  2. date <=>
  3. ipaddr <=>
  4. openssl <=>

ライブラリ

クラス

モジュール

キーワード

検索結果

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

Gem::Version#<=>(other) -> -1 | 0 | 1 | nil (18124.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 比較対...

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

Numeric#<=>(other) -> -1 | 0 | 1 | nil (18124.0)

自身が other より大きい場合に 1 を、等しい場合に 0 を、小さい場合には -1 をそれぞれ返します。 自身と other が比較できない場合には nil を返します。

...Numeric のサブクラスは、上の動作を満たすよう このメソッドを適切に再定義しなければなりません。

@param other 自身と比較したい数値を指定します。

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

OpenSSL::BN#<=>(other) -> -1 | 0 | 1 (18124.0)

自身と other を比較し、自身が小さいときには -1、 等しいときには 0、大きいときには 1 を返します。

...1 を返します。

//emlist[][ruby]{
require 'openssl'

OpenSSL::BN.new(5) <=> 5 # => 0

OpenSSL::BN.new(5) <=> OpenSSL::BN.new(9) # => -1
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(5) # => 0
OpenSSL::BN.new(5) <=> OpenSSL::BN.new(-5) # => 1
//}

@param other 比較する整数
@raise TypeErr...

Symbol#<=>(other) -> -1 | 0 | 1 | nil (18124.0)

self と other のシンボルに対応する文字列を ASCII コード順で比較して、 self が小さい時には -1、等しい時には 0、大きい時には 1 を返します。

...er がシンボルではなく比較できない時には nil を返します。

@param other 比較対象のシンボルを指定します。

//emlist[][ruby]{
p :aaa <=> :xxx # => -1
p :aaa <=> :aaa # => 0
p :xxx <=> :aaa # => 1
p :foo <=> "foo" # => nil
//}

@see String#<=>, Symbol#casecmp...

絞り込み条件を変える

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

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

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

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

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

File::Stat#<=>(o) -> Integer | nil (18118.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 (18118.0)

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

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

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

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

Pathname#<=>(other) -> -1 | 0 | 1 | nil (18118.0)

パス名を比較します。other と同じなら 0 を、ASCII順で self が大きい場合 は正、other が大きい場合は負を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。

...対象の Pathname オブジェクトを指定します。

//emlist[例][ruby]{
require 'pathname'

p Pathname.new("foo/bar") <=> Pathname.new("foo/bar")
p Pathname.new("foo/bar") <=> Pathname.new("foo//bar")
p Pathname.new("foo/../foo/bar") <=> Pathname.new("foo/bar")
# => 0
# 1
# -1
//}...

Object#<=>(other) -> 0 | nil (18112.0)

self === other である場合に 0 を返します。そうでない場合には nil を返します。

...self === other である場合に 0 を返します。そうでない場合には nil を返します。

//emlist[例][ruby]{
a = Object.new
b = Object.new
a <=> a # => 0
a <=> b # => nil
//}

@see Object#===...

絞り込み条件を変える

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

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

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

self と other が比較できない場合には nil を返します。
<< < 1 2 3 4 ... > >>