種類
- インスタンスメソッド (1174)
- 特異メソッド (79)
- クラス (22)
- モジュール関数 (22)
- 定数 (2)
ライブラリ
- ビルトイン (1299)
クラス
- Array (58)
- BasicObject (33)
- Bignum (9)
- Binding (11)
- Complex (11)
- Data (4)
-
Enumerator
:: ArithmeticSequence (6) -
Enumerator
:: Lazy (33) - Exception (11)
- FalseClass (33)
- File (22)
- Fixnum (3)
- Float (22)
- Hash (139)
- Integer (43)
- KeyError (7)
- MatchData (22)
- Method (33)
- Module (11)
- Numeric (11)
- Object (55)
- Proc (11)
- Random (35)
- Range (32)
- Rational (11)
- Regexp (33)
- String (245)
- Struct (22)
- Symbol (33)
- Thread (22)
- Time (44)
- TrueClass (33)
- UnboundMethod (44)
モジュール
- Comparable (11)
- Enumerable (80)
- GC (22)
- Math (22)
キーワード
- & (22)
- +@ (9)
- -@ (9)
- === (69)
- DEFAULT (2)
- String (11)
- Symbol (11)
- [] (66)
- ^ (22)
-
_ _ id _ _ (11) - acos (11)
- allbits? (7)
- asin (11)
- chunk (22)
- clone (22)
- dedup (2)
- dup (11)
- eql? (104)
- equal? (11)
- filter! (12)
- getgm (11)
- getlocal (22)
- getutc (11)
- group (11)
-
has
_ value? (11) - hash (33)
- id2name (11)
- include? (27)
- intern (11)
- itself (11)
-
keep
_ if (22) - key (7)
-
latest
_ gc _ info (22) - lazy (11)
-
local
_ variable _ defined? (11) - lstat (22)
-
marshal
_ dump (11) -
marshal
_ load (11) - member? (16)
- new (28)
- nobits? (7)
- none? (47)
- one? (47)
-
pending
_ interrupt? (11) - select! (22)
- slice (66)
- sqrt (7)
-
to
_ h (17) -
to
_ hash (11) -
to
_ proc (11) -
to
_ s (11) -
to
_ sym (11) -
unicode
_ normalize! (10) - value? (11)
- | (22)
検索結果
先頭5件
-
Symbol
# ==(other) -> true | false (26219.0) -
other が同じシンボルの時に真を返します。 そうでない場合は偽を返します。
...other が同じシンボルの時に真を返します。
そうでない場合は偽を返します。
@param other 比較対象のシンボルを指定します。
例:
:aaa == :aaa #=> true
:aaa == :xxx #=> false... -
MatchData
# ==(other) -> bool (26170.0) -
self と other のマッチ対象になった文字列、元になった正規表現オブジェク ト、マッチした位置が等しければ true を返します。そうでない場合には false を返します。
...ければ true を返します。そうでない場合には
false を返します。
@param other 比較対象のオブジェクトを指定します。
//emlist[文字列][ruby]{
s = "abc"
m1 = s.match("a")
m2 = s.match("b")
m1 == m2 # => false
m2 = s.match("a")
m1 == m2 # => true
//}
//emlis......#<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
//}... -
Hash
# ==(other) -> bool (26164.0) -
自身と other が同じ数のキーを保持し、キーが 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?... -
Exception
# ==(other) -> bool (26162.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...自身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。......on を実行して変換を試みます。
//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......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, backtrace が同一だが、message がことなるため false になる
p results[0] == results[2] # => false
//}... -
Range
# ==(other) -> bool (26162.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
//}... -
Array
# ==(other) -> bool (26156.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
//}... -
Data
# ==(other) -> bool (26156.0) -
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。
...self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に
true を返します。そうでない場合に false を返します。
@param other self と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
Dog = Data.def......ine(:name, :age)
dog1 = Dog.new("Fred", 5)
dog2 = Dog.new("Fred", 5.0)
p 5 == 5.0 # => true
p 5.eql?(5.0) # => false
p dog1 == dog2 # => true
p dog1.eql?(dog2) # => false
p dog1.equal?(dog2) # => false
//}
[注意] 本メソッドの記述は Data のサブクラ......スのインスタンスに対して呼び
出す事を想定しています。Data.define は Data のサブクラスを作成する点に
注意してください。
@see Object#==, Data#eql?... -
Rational
# ==(other) -> bool (26154.0) -
数値として等しいか判定します。
...が等しい場合 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
//}... -
Regexp
# ==(other) -> bool (26152.0) -
otherが同じパターン、オプション、文字コードの正規表現であったらtrueを返します。
...たらtrueを返します。
@param other 正規表現を指定します。
//emlist[例][ruby]{
p /^eee$/ == /~eee$/x # => false
p /^eee$/ == /~eee$/i # => false
p /^eee$/e == /~eee$/u # => false
p /^eee$/ == Regexp.new("^eee$") # => true
p /^eee$/.eql?(/^eee$/) # => true
//}... -
Struct
# ==(other) -> bool (26150.0) -
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。
...self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に
true を返します。そうでない場合に false を返します。
@param other self と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
Dog = Struct.n......ew(:name, :age)
dog1 = Dog.new("fred", 5)
dog2 = Dog.new("fred", 5)
p dog1 == dog2 #=> true
p dog1.eql?(dog2) #=> true
p dog1.equal?(dog2) #=> false
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す...