ライブラリ
- English (33)
- ビルトイン (805)
- bigdecimal (11)
-
cgi
/ html (308) -
cgi
/ session (11) - csv (11)
- date (11)
- ipaddr (11)
- logger (11)
- nkf (11)
- observer (11)
- ostruct (11)
- pathname (11)
- rake (33)
-
rexml
/ document (264) -
rexml
/ sax2listener (11) -
rubygems
/ version (11) - set (33)
- timeout (19)
-
webrick
/ httputils (55) -
webrick
/ httpversion (11)
クラス
- Array (134)
- BasicObject (11)
- BigDecimal (11)
- Bignum (3)
-
CGI
:: Session (11) -
CSV
:: Row (11) - Class (11)
- Complex (5)
- Date (11)
-
Encoding
:: Converter (11) - Exception (11)
-
File
:: Stat (11) - Float (11)
-
Gem
:: Version (11) - Hash (44)
- IPAddr (11)
- Integer (11)
- Logger (11)
- Method (20)
- Module (38)
- Numeric (11)
- Object (55)
- Pathname (11)
-
REXML
:: Attributes (33) -
REXML
:: CData (11) -
REXML
:: Element (99) -
REXML
:: Elements (55) -
REXML
:: Instruction (11) -
REXML
:: Text (11) -
REXML
:: XPath (33) - Range (106)
- Rational (11)
-
RubyVM
:: InstructionSequence (75) - Set (33)
- String (39)
- Symbol (11)
- Thread (22)
- Time (11)
-
WEBrick
:: HTTPUtils :: FormData (55) -
WEBrick
:: HTTPVersion (11)
モジュール
-
CGI
:: HtmlExtension (308) - Comparable (22)
- Enumerable (88)
- Kernel (66)
-
REXML
:: SAX2Listener (11) -
Rake
:: TaskManager (33) - Timeout (19)
キーワード
- ! (11)
-
$ ERROR _ INFO (11) -
$ ERROR _ POSITION (11) -
$ LAST _ PAREN _ MATCH (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (44)
- <= (22)
- <=> (195)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (3) - NKF (11)
- Observable (11)
- OpenStruct (11)
- Ruby プログラムの実行 (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- XMLDecl (11)
- [] (44)
-
absolute
_ path (11) - add (22)
- add? (11)
-
add
_ element (11) - attribute (11)
-
backtrace
_ locations (22) - bsearch (44)
-
bsearch
_ index (18) - compile (11)
-
compile
_ file (11) -
const
_ source _ location (5) - content (11)
-
delete
_ attribute (11) -
delete
_ if (22) - disasm (11)
- disassemble (11)
- each (22)
-
each
_ element _ with _ attribute (11) -
each
_ element _ with _ text (11) -
enum
_ for (22) -
file
_ field (22) - filename (11)
- filename= (11)
- first (11)
- form (44)
-
get
_ attribute (11) -
get
_ attribute _ ns (11) -
get
_ text (11) - hidden (22)
- img (22)
-
insert
_ output (11) - inspect (5)
- lookup (11)
- match (11)
- max (118)
- min (118)
-
minitest
/ unit (1) -
multipart
_ form (44) - name (11)
- name= (11)
- new (44)
-
next
_ element (11) - open-uri (11)
- pack (19)
- pack テンプレート文字列 (11)
-
password
_ field (22) - print (11)
- reject! (22)
- reset (22)
-
rexml
/ document (11) -
rexml
/ parsers / pullparser (11) -
rexml
/ parsers / sax2parser (11) -
rexml
/ parsers / streamparser (11) -
rexml
/ parsers / ultralightparser (11) -
rinda
/ rinda (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
set
_ backtrace (11) - split (17)
-
start
_ prefix _ mapping (11) - submit (22)
-
super
_ method (10) - superclass (11)
-
synthesize
_ file _ task (11) - test (22)
- text (11)
- text= (11)
-
text
_ field (22) - timeout (19)
-
to
_ a (11) -
to
_ binary (9) -
to
_ enum (22) -
to
_ s (5) - unpack (11)
- xmlrpc (3)
- クラス/メソッドの定義 (11)
- メソッド呼び出し(super・ブロック付き・yield) (11)
- 制御構造 (11)
- 変数と定数 (11)
- 正規表現 (11)
- 演算子式 (11)
検索結果
先頭5件
-
Module
# <(other) -> bool | nil (18255.0) -
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
...較では
nil を返します。
@param other 比較対象のモジュールやクラス
@raise TypeError other がクラスやモジュールではない場合に発生します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo #......=> true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil
p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}... -
Comparable
# <(other) -> bool (18118.0) -
比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が負の整数を返した場合に、true を返します。 それ以外の整数を返した場合に、false を返します。
... <=> をもとにオブジェクト同士を比較します。
<=> が負の整数を返した場合に、true を返します。
それ以外の整数を返した場合に、false を返します。
@param other 自身と比較したいオブジェクトを指定します。
@raise ArgumentError <......=> が nil を返したときに発生します。
//emlist[例][ruby]{
1 < 1 # => false
1 < 2 # => true
//}... -
Module
# <=>(other) -> Integer | nil (6237.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 <=> Ba......r # => -1
p Baz <=> Foo # => -1
p Baz <=> Qux # => nil
p Qux <=> Baz # => nil
p Baz <=> Object.new # => nil
//}... -
Rational
# <=>(other) -> -1 | 0 | 1 | nil (6235.0) -
self と other を比較して、self が大きい時に 1、等しい時に 0、小さい時に -1 を返します。比較できない場合はnilを返します。
...合はnilを返します。
@param other 自身と比較する数値
@return -1 か 0 か 1 か nil を返します。
//emlist[例][ruby]{
Rational(2, 3) <=> Rational(2, 3) # => 0
Rational(5) <=> 5 # => 0
Rational(2, 3) <=> Rational(1,3) # => 1
Rational(1, 3) <=> 1......# => -1
Rational(1, 3) <=> 0.3 # => 1
Rational(1, 3) <=> nil # => nil
//}... -
Float
# <=>(other) -> -1 | 0 | 1 | nil (6229.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
//}... -
Integer
# <=>(other) -> -1 | 0 | 1 | nil (6229.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
//}... -
File
:: Stat # <=>(o) -> Integer | nil (6223.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
//}... -
Gem
:: Version # <=>(other) -> -1 | 0 | 1 | nil (6223.0) -
self と other を比較して、self が小さい時に -1、 等しい時に 0、大きい時に 1 の整数を返します。 また、other が Gem::Version ではなく比較できないとき、 nil を返します。
... 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
//}... -
Numeric
# <=>(other) -> -1 | 0 | 1 | nil (6223.0) -
自身が other より大きい場合に 1 を、等しい場合に 0 を、小さい場合には -1 をそれぞれ返します。 自身と other が比較できない場合には nil を返します。
...には nil を返します。
Numeric のサブクラスは、上の動作を満たすよう このメソッドを適切に再定義しなければなりません。
@param other 自身と比較したい数値を指定します。
//emlist[例][ruby]{
1 <=> 0 #=> 1
1 <=> 1 #=> 0
1 <=> 2 #=>......-1
1 <=> "0" #=> nil
//}... -
Object
# <=>(other) -> 0 | nil (6223.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#===...