ライブラリ
- ビルトイン (643)
- bigdecimal (11)
- date (11)
- fiddle (11)
-
fiddle
/ import (11) - ipaddr (11)
- openssl (44)
- pathname (11)
-
rdoc
/ context (11) -
rexml
/ document (11) -
rubygems
/ dependency (11) -
rubygems
/ version (11) -
webrick
/ httpversion (11)
クラス
- Array (85)
- BigDecimal (11)
- Bignum (3)
- Complex (5)
- Date (11)
-
Fiddle
:: Pointer (11) -
File
:: Stat (11) - Fixnum (3)
- Float (11)
-
Gem
:: Dependency (11) -
Gem
:: Version (11) - IPAddr (11)
- Integer (11)
- Module (11)
- Numeric (22)
- Object (11)
-
OpenSSL
:: BN (22) -
OpenSSL
:: X509 :: Name (22) - Pathname (11)
-
RDoc
:: Context (11) -
REXML
:: Comment (11) - Range (138)
- Rational (11)
- String (11)
- Symbol (11)
- Time (11)
-
WEBrick
:: HTTPVersion (11)
モジュール
- Comparable (24)
- Enumerable (264)
-
Fiddle
:: Importer (11)
検索結果
先頭5件
-
WEBrick
:: HTTPVersion # <=>(other) -> -1 | 0 | 1 | nil (21201.0) -
自身と指定された other のバージョンを比較します。 自身が other より新しいなら 1、同じなら 0、古いなら -1 を返します。 比較できない場合に nil を返します。
...ら -1 を返します。
比較できない場合に nil を返します。
@param other HTTP のバージョンを表す WEBrick::HTTPVersion オブジェクトか文字列を指定します。
require 'webrick'
v = WEBrick::HTTPVersion.new('1.1')
p v < '1.0' #=> f... -
OpenSSL
:: BN # <=>(other) -> -1 | 0 | 1 (21125.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 T......ypeError 比較できないときに発生します。
@see OpenSSL::BN#ucmp... -
OpenSSL
:: X509 :: Name # <=>(other) -> -1 | 0 | 1 (21101.0) -
他の OpenSSL::X509::Name オブジェクトと比較します。
...他の OpenSSL::X509::Name オブジェクトと比較します。
自身が other と一致する場合は 0、otherより大きい場合は1、
小さい場合は -1 を返します。
@param other 比較するオブジェクト... -
RDoc
:: Context # <=>(other) -> -1 | 0 | 1 (21101.0) -
自身と other の full_name を比較した結果を返します。
...自身と other の full_name を比較した結果を返します。
ソートのために使われます。
@param other 自身と比較したいオブジェクトを指定します。... -
REXML
:: Comment # <=>(other) -> -1 | 0 | 1 (21101.0) -
other と内容(REXML::Comment#string)を比較します。
...other と内容(REXML::Comment#string)を比較します。... -
Complex
# <=>(other) -> -1 | 0 | 1 | nil (18247.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
//}... -
Module
# <=>(other) -> Integer | nil (18237.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
//}... -
Array
# <=>(other) -> -1 | 0 | 1 | nil (18235.0) -
自身と other の各要素をそれぞれ順に <=> で比較していき、結果が 0 でなかった場合に その値を返します。各要素が等しく、配列の長さも等しい場合には 0 を返します。 各要素が等しいまま一方だけ配列の末尾に達した時、自身の方が短ければ -1 をそうでなければ 1 を返します。 other に配列以外のオブジェクトを指定した場合は nil を返します。
...自身と other の各要素をそれぞれ順に <=> で比較していき、結果が 0 でなかった場合に
その値を返します。各要素が等しく、配列の長さも等しい場合には 0 を返します。
各要素が等しいまま一方だけ配列の末尾に達した時、......場合は nil を返します。
@param other 自身と比較したい配列を指定します。
配列以外のオブジェクトを指定した場合は to_ary メソッドによ
る暗黙の型変換を試みます。
//emlist[例][ruby]{
[ 1, 2, 3 ] <=> [ 1, 3, 2 ]......#=> -1
[ 1, 2, 3 ] <=> [ 1, 2, 3 ] #=> 0
[ 1, 2, 3 ] <=> [ 1, 2 ] #=> 1
//}... -
Date
# <=>(other) -> -1 | 0 | 1 | nil (18232.0) -
二つの日付を比較します。 同じ日付なら 0 を、self が other よりあとの日付なら 1 を、 その逆なら -1 を返します。
...で nil を返します。
//emlist[][ruby]{
require "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
//}
@param other 日付オブジェクトまたは数値... -
File
:: Stat # <=>(o) -> Integer | nil (18231.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
//}... -
Float
# <=>(other) -> -1 | 0 | 1 | nil (18231.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
//}...