クラス
-
ARGF
. class (88) - Array (263)
- BasicObject (33)
- Bignum (9)
- Binding (11)
- Complex (11)
- Data (4)
-
Enumerator
:: ArithmeticSequence (6) -
Enumerator
:: Lazy (118) - Exception (22)
- FalseClass (33)
- File (11)
- Fixnum (3)
- Float (33)
- Hash (156)
- Integer (36)
- MatchData (22)
- Method (36)
- Module (11)
- Numeric (22)
- Object (66)
- Proc (33)
-
Process
:: Status (11) - Random (33)
- Range (76)
- Rational (11)
- Regexp (33)
-
RubyVM
:: InstructionSequence (11) - String (212)
- Struct (22)
- Symbol (33)
- Time (22)
- TrueClass (33)
- UnboundMethod (33)
モジュール
- Comparable (11)
- Enumerable (422)
キーワード
- != (11)
- & (22)
- +@ (9)
- -@ (9)
- === (80)
- [] (33)
- ^ (22)
- allbits? (7)
- assoc (22)
-
backtrace
_ locations (11) - call (25)
- chunk (22)
-
chunk
_ while (11) - clone (22)
- collect (11)
- count (33)
- crypt (11)
- dedup (2)
- delete (22)
-
delete
_ if (22) - detect (22)
- disassemble (11)
- divmod (11)
- dup (11)
- each (44)
-
each
_ line (44) - eql? (104)
- equal? (11)
- filter (12)
- filter! (12)
- find (22)
-
find
_ all (22) -
find
_ index (55) - getlocal (22)
-
has
_ value? (11) - id2name (11)
- include? (27)
- index (22)
- intern (11)
- itself (11)
-
keep
_ if (17) - lazy (22)
-
local
_ variable _ defined? (11) - lstat (11)
- map (11)
-
marshal
_ dump (11) -
marshal
_ load (11) - max (82)
- member? (16)
- min (82)
- modulo (11)
- nobits? (7)
- none? (47)
- one? (47)
- pack (19)
- partition (22)
- rassoc (22)
- reject (22)
- reject! (22)
- rindex (22)
- select (22)
- select! (22)
- slice (66)
-
slice
_ after (20) -
slice
_ before (33) -
slice
_ when (10) - sort (22)
- split (17)
-
to
_ h (17) -
to
_ hash (11) -
to
_ proc (11) -
to
_ s (11) -
to
_ sym (11) -
unicode
_ normalize! (10) - unpack (11)
- value? (11)
- yield (11)
- | (22)
検索結果
先頭5件
-
Float
# ==(other) -> bool (21233.0) -
比較演算子。数値として等しいか判定します。
...urn self と other が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[例][ruby]{
3.14 == 3.14000 # => true
3.14 == 3.1415 # => false
//}
NaNどうしの比較は、未定義です。
//emlist[例][ruby]{
Float::NAN == Float::NAN......# => false
[Float::NAN] == [Float::NAN] # => true
[Float::NAN] == [0.0 / 0.0] # => false
//}... -
Rational
# ==(other) -> bool (21233.0) -
数値として等しいか判定します。
...self と other が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[例][ruby]{
Rational(2, 3) == Rational(2, 3) # => true
Rational(5) == 5 # => true
Rational(0) == 0.0 # => true
Rational('1/3') == 0.......33 # => false
Rational('1/2') == '1/2' # => false
//}... -
Complex
# ==(other) -> bool (21221.0) -
数値として等しいか判定します。
...数値として等しいか判定します。
@param other 自身と比較する数値
//emlist[例][ruby]{
Complex(2, 1) == Complex(1) # => false
Complex(1, 0) == Complex(1) # => true
Complex(1, 0) == 1 # => true
//}... -
Comparable
# ==(other) -> bool (21215.0) -
比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が 0 を返した時に、true を返します。 それ以外を返した場合は、false を返します。
...ジェクト同士を比較します。
<=> が 0 を返した時に、true を返します。
それ以外を返した場合は、false を返します。
@param other 自身と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
1 == 1 # => true
1 == 2 # => false
//}... -
Symbol
# ==(other) -> true | false (21215.0) -
other が同じシンボルの時に真を返します。 そうでない場合は偽を返します。
...other が同じシンボルの時に真を返します。
そうでない場合は偽を返します。
@param other 比較対象のシンボルを指定します。
例:
:aaa == :aaa #=> true
:aaa == :xxx #=> false... -
Hash
# ==(other) -> bool (18249.0) -
自身と other が同じ数のキーを保持し、キーが eql? メソッドで比較して全て等しく、 値が == メソッドで比較して全て等しい場合に真を返します。
...キーが eql? メソッドで比較して全て等しく、
値が == メソッドで比較して全て等しい場合に真を返します。
@param other 自身と比較したい Hash オブジェクトを指定します。
//emlist[例][ruby]{
#(出力関数は省略)
{ 1 => :a } == { 1 => :a......} #=> true
{ 1 => :a } == { 1 => :a, 2 => :b } #=> false
{ 1 => :a } == { 1.0 => :a } #=> false ( 1.eql?(1.0) は false なので)
{ :x => 1 } == { :x => 1.0 } #=> true ( 1 == 1.0 は true なので)
//}
@see Hash#equal?... -
MatchData
# ==(other) -> bool (18239.0) -
self と other のマッチ対象になった文字列、元になった正規表現オブジェク ト、マッチした位置が等しければ true を返します。そうでない場合には false を返します。
...self と other のマッチ対象になった文字列、元になった正規表現オブジェク
ト、マッチした位置が等しければ true を返します。そうでない場合には
false を返します。
@param other 比較対象のオブジェクトを指定します。
//emlis......")
m1 == m2 # => false
m2 = s.match("a")
m1 == m2 # => true
//}
//emlist[正規表現][ruby]{
r = /abc/
m1 = r.match("abc") # => #<MatchData "abc">
m2 = r.match("abcde") # => #<MatchData "abc">
m1 == m2 # => false
m2 = r.match("abc") # => #<MatchData "abc">
m1 == m2 # => true
//}
//emlist[......正規表現のマッチした位置][ruby]{
r = /abc/
m1 = r.match("abcabc") # => #<MatchData "abc">
m2 = r.match("abcabc", 3) # => #<MatchData "abc">
m1 == m2 # => false
m2 = r.match("abcabc", 0) # => #<MatchData "abc">
m1 == m2 # => true
//}... -
Array
# ==(other) -> bool (18237.0) -
自身と other の各要素をそれぞれ順に == で比較し て、全要素が等しければ true を返します。そうでない場合には false を返します。
... == で比較し
て、全要素が等しければ true を返します。そうでない場合には false を返します。
@param other 自身と比較したい配列を指定します。
@see Object#==
//emlist[例][ruby]{
[ "a", "c" ] == [ "a", "c", 7 ] #=> false
[ "a", "c", 7 ] == [......"a", "c", 7 ] #=> true
[ "a", "c", 7 ] == [ "a", "d", "f" ] #=> false
//}... -
Exception
# ==(other) -> bool (18237.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...自身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。......。
//emlist[例][ruby]{
require "date"
def check_long_month(month)
return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
results = [2, 2, 4].map { |e | get_exception { check_long_month(e)......p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, RuntimeError]
p results.map { |e| e.message }
# => ["2 is not long month", "2 is not long month", "4 is not long month"]
# class, message, backtrace が同一のため true になる
p results[0] == results[1] # => true
# class, b... -
Range
# ==(other) -> bool (18237.0) -
指定された other が Range クラスのインスタンスであり、 始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に true を返します。そうでない場合に false を返します。
...始端と終端が == メソッドで比較して等しく、Range#exclude_end? が同じ場合に
true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
p (1..2) == (1..2)......# => true
p (1..2) == (1...2) # => false
p (1..2) == Range.new(1.0, 2.0) # => true
//}...