別のキーワード
ライブラリ
- ビルトイン (863)
- bigdecimal (12)
- date (12)
- fiddle (36)
-
fiddle
/ import (12) - ipaddr (12)
- openssl (48)
- pathname (12)
- rake (12)
-
rdoc
/ context (12) -
rexml
/ document (24) -
rubygems
/ dependency (12) -
rubygems
/ version (12) -
webrick
/ httpversion (12)
クラス
- Array (144)
- BigDecimal (12)
- Bignum (3)
- Complex (6)
- Date (12)
-
Fiddle
:: Pointer (12) -
File
:: Stat (12) - Fixnum (3)
- Float (12)
-
Gem
:: Dependency (12) -
Gem
:: Version (12) - IPAddr (12)
- Integer (12)
- Module (12)
- Numeric (24)
- Object (12)
-
OpenSSL
:: BN (24) -
OpenSSL
:: X509 :: Name (24) - Pathname (12)
-
RDoc
:: Context (12) -
REXML
:: Comment (12) -
REXML
:: Text (12) -
Rake
:: EarlyTime (12) - Range (164)
- Rational (12)
- String (12)
- Symbol (12)
- Time (12)
-
WEBrick
:: HTTPVersion (12)
モジュール
- Comparable (87)
- Enumerable (288)
-
Fiddle
:: Importer (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - < (12)
- <= (12)
- == (12)
- === (5)
- > (12)
- >= (12)
- BlockCaller (12)
- Closure (12)
- Comparable (12)
-
NEWS for Ruby 2
. 7 . 0 (6) - Numeric (12)
- Range (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Ruby用語集 (12)
- between? (12)
- bind (12)
- clamp (15)
- cmp (24)
- cover? (19)
- fiddle (12)
-
fiddle
/ import (12) - include? (12)
- max (130)
-
max
_ by (48) - member? (12)
- min (130)
-
min
_ by (48) - minmax (48)
-
minmax
_ by (24) - new (12)
- nonzero? (12)
- rss (12)
-
ruby 1
. 8 . 3 feature (12) - sort (48)
- sort! (24)
-
sort
_ by (24) - 演算子式 (12)
検索結果
先頭5件
-
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 を返します。