別のキーワード
種類
- インスタンスメソッド (467)
- 文書 (33)
- クラス (11)
ライブラリ
- ビルトイン (401)
- bigdecimal (22)
- date (11)
- ipaddr (11)
- pathname (11)
-
rubygems
/ dependency (11) -
rubygems
/ version (11)
クラス
モジュール
- Comparable (11)
- Enumerable (11)
キーワード
- % (11)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - < (11)
- <=> (176)
- Numeric (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- between? (11)
- bsearch (22)
-
bsearch
_ index (18) -
chunk
_ while (11) - cover? (12)
- div (11)
- divmod (22)
- modulo (11)
- remainder (11)
-
ruby 1
. 6 feature (11) - step (84)
検索結果
先頭5件
-
Module
# <=(other) -> bool | nil (18184.0) -
比較演算子。self が other の子孫であるか、self と other が 同一クラスである場合、 true を返します。 self が other の先祖である場合、false を返します。
...比較演算子。self が other の子孫であるか、self と other が
同一クラスである場合、 true を返します。
self が other の先祖である場合、false を返します。
継承関係にないクラス同士の比較では
nil を返します。
@param other 比較......ule#<
//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend Foo
end
Bar.ancestors # => [Bar, Foo]
Foo <= Bar # => false
Bar <= Foo # => true
Baz.ancestors # => [Foo, Baz]
Foo <= Baz # => false
Baz <= Foo # => true
Foo <= Foo # => true
Foo <= Object # => nil
//}... -
Hash
# <=(other) -> bool (18134.0) -
self が other のサブセットか同じである場合に真を返します。
...
self が other のサブセットか同じである場合に真を返します。
@param other 自身と比較したい Hash オブジェクトを指定します。
//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 <= h2 # => true
h2 <= h1 # => false
h1 <= h1 # => true
//}
@see... -
Integer
# <=(other) -> bool (18124.0) -
比較演算子。数値として等しいまたは小さいか判定します。
...other 比較対象の数値
@return self よりも other の方が大きい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 <= 0 # => false
1 <= 1 # => true
1 <= 2 # => true
//}... -
BigDecimal
# <=(other) -> bool (18116.0) -
self が other より小さいか等しい場合に true を、そうでない場合に false を返します。
...
self が other より小さいか等しい場合に true を、そうでない場合に false
を返します。... -
Float
# <=(other) -> bool (18112.0) -
比較演算子。数値として等しいまたは小さいか判定します。
...param other 比較対象の数値
@return self よりも other の方が大きい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[例][ruby]{
3.14 < 3.1415 # => true
3.14 <= 3.1415 # => true
//}... -
Fixnum
# <=(other) -> bool (18106.0) -
比較演算子。数値として等しいまたは小さいか判定します。
...比較演算子。数値として等しいまたは小さいか判定します。
@param other 比較対象の数値
@return self よりも other の方が大きい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返しま... -
String
# <=>(other) -> -1 | 0 | 1 | nil (6138.0) -
self と other を ASCII コード順で比較して、 self が大きい時には 1、等しい時には 0、小さい時には -1 を返します。 このメソッドは Comparable モジュールのメソッドを実装するために使われます。
...
self と other を ASCII コード順で比較して、
self が大きい時には 1、等しい時には 0、小さい時には -1 を返します。
このメソッドは Comparable モジュールのメソッドを実装するために使われます。
other が文字列でない場合、
othe......other.<=> が定義されていれば
0 - (other <=> self) の結果を返します。
そうでなければ nil を返します。
@param other 文字列
@return 比較結果の整数か nil
//emlist[例][ruby]{
p "aaa" <=> "xxx" # => -1
p "aaa" <=> "aaa" # => 0
p "xxx" <=> "aaa"......# => 1
p "string" <=> "stringAA" # => -1
p "string" <=> "string" # => 0
p "stringAA" <=> "string" # => 1
//}... -
Module
# <=>(other) -> Integer | nil (6134.0) -
self と other の継承関係を比較します。
...
self と other の継承関係を比較します。
self と other を比較して、
self が other の子孫であるとき -1、
同一のクラス/モジュールのとき 0、
self が other の先祖であるとき 1
を返します。
継承関係にないクラス同士の比較では
n......のクラスやモジュール
//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
//}... -
Bignum
# <=>(other) -> Fixnum | nil (6132.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 (6132.0) -
self の虚部がゼロで other が実数の場合、 self の実部の <=> メソッドで other と比較した結果を返します。 other が Complex で虚部がゼロの場合も同様です。
...
self の虚部がゼロで other が実数の場合、
self の実部の <=> メソッドで other と比較した結果を返します。
other が Complex で虚部がゼロの場合も同様です。
その他の場合は nil を返します。
@param other 自身と比較する数値
//emlis......t[例][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
//}... -
Fixnum
# <=>(other) -> Fixnum (6132.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 (6132.0) -
self と other を比較して、self が大きい時に正、 等しい時に 0、小さい時に負の整数を返します。 比較できない場合はnilを返します
...self と other を比較して、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
//}...