種類
- インスタンスメソッド (740)
- 特異メソッド (44)
クラス
-
ARGF
. class (66) - Array (44)
- BasicObject (33)
- Bignum (9)
- Data (4)
-
Enumerator
:: Lazy (11) - Fixnum (3)
- Float (22)
- Hash (79)
- Integer (36)
- MatchData (22)
- Method (28)
- Numeric (55)
- Object (22)
- Proc (11)
-
Process
:: Status (11) - Rational (11)
-
RubyVM
:: InstructionSequence (22) - String (218)
- Struct (22)
- SystemCallError (11)
モジュール
- Enumerable (11)
オブジェクト
- ENV (33)
キーワード
- != (11)
- % (11)
- +@ (9)
- -@ (9)
- === (43)
- [] (73)
- allbits? (7)
- call (14)
-
chunk
_ while (11) - crypt (11)
- dedup (2)
-
delete
_ if (22) - disasm (11)
- disassemble (11)
- div (11)
- divmod (22)
- each (44)
-
each
_ key (11) -
each
_ line (33) -
each
_ pair (11) - eql? (27)
- equal? (11)
- filter! (12)
- hash (22)
- itself (11)
-
keep
_ if (17) - lazy (11)
- modulo (11)
- nobits? (7)
- reject! (22)
- remainder (11)
- select! (22)
- slice (66)
- split (12)
-
to
_ h (17) -
to
_ hash (11) -
to
_ proc (11) -
unicode
_ normalize! (10)
検索結果
先頭5件
-
MatchData
# ==(other) -> bool (21354.0) -
self と other のマッチ対象になった文字列、元になった正規表現オブジェク ト、マッチした位置が等しければ true を返します。そうでない場合には false を返します。
...
self と other のマッチ対象になった文字列、元になった正規表現オブジェク
ト、マッチした位置が等しければ true を返します。そうでない場合には
false を返します。
@param other 比較対象のオブジェクトを指定します。
//emlis......t[文字列][ruby]{
s = "abc"
m1 = s.match("a")
m2 = s.match("b")
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... -
Data
# ==(other) -> bool (21352.0) -
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。
...
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に
true を返します。そうでない場合に false を返します。
@param other self と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
Dog = Data.def......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?... -
Struct
# ==(other) -> bool (21346.0) -
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。
...
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に
true を返します。そうでない場合に false を返します。
@param other self と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
Dog = Struct.n......, 5)
p dog1 == dog2 #=> true
p dog1.eql?(dog2) #=> true
p dog1.equal?(dog2) #=> false
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位......クラスを作成する点に
注意してください。
@see Struct#eql?... -
Float
# ==(other) -> bool (21338.0) -
比較演算子。数値として等しいか判定します。
...am other 比較対象の数値
@return 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 (21338.0) -
数値として等しいか判定します。
...other 自身と比較する数値
@return 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
//}... -
String
# ==(other) -> bool (21332.0) -
other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false......m other 任意のオブジェクト
@return true か false
//emlist[例][ruby]{
stringlike = Object.new
def stringlike.==(other)
"string" == other
end
p "string".eql?(stringlike) #=> false
p "string" == stringlike #=> false
def stringlike.to_str
raise
end
p "string".eql?(strin......glike) #=> false
p "string" == stringlike #=> true
//}
@see String#eql?... -
BasicObject
# ==(other) -> bool (21320.0) -
オブジェクトが other と等しければ真を、さもなくば偽を返します。
...オブジェクトが other と等しければ真を、さもなくば偽を返します。
このメソッドは各クラスの性質に合わせて、サブクラスで再定義するべきです。
多くの場合、オブジェクトの内容が等しければ真を返すように (同値性を......ォルトでは Object#equal? と同じオブジェクトの同一性になっています。
@param other 比較対象となるオブジェクト
@return other が self と同値であれば真、さもなくば偽
//emlist[例][ruby]{
class Person < BasicObject
def initialize(name, age)
@n......ame = name
@age = age
end
end
tanaka1 = Person.new("tanaka", 24)
tanaka2 = Person.new("tanaka", 24)
tanaka1 == tanaka1 #=> true
tanaka1 == tanaka2 #=> false
//}
@see BasicObject#equal?, Object#==, Object#equal?,
Object#eql?... -
Integer
# ==(other) -> bool (21320.0) -
比較演算子。数値として等しいか判定します。
...比較演算子。数値として等しいか判定します。
@param other 比較対象の数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 == 2 # => false
1 == 1.0 # => true
//}... -
Process
:: Status # ==(other) -> bool (21308.0) -
同じステータスの場合に真を返します。
...同じステータスの場合に真を返します。
other が数値の場合、self.to_i との比較が行われます。こ
れは後方互換性のためです。
@param other 自身と比較したいオブジェクトを指定します。... -
Bignum
# ==(other) -> bool (18308.0) -
比較演算子。数値として等しいか判定します。
...比較演算子。数値として等しいか判定します。
@param other 比較対象の数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。... -
Fixnum
# ==(other) -> bool (18308.0) -
比較演算子。数値として等しいか判定します。
...比較演算子。数値として等しいか判定します。
@param other 比較対象の数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。... -
SystemCallError
. ===(other) -> bool (15436.0) -
other が SystemCallError のサブクラスのインスタンスで、 かつ、other.errno の値が self::Errno と同じ場合に真を返します。そうでない場合は偽を返します。
...other が SystemCallError のサブクラスのインスタンスで、
かつ、other.errno の値が self::Errno と同じ場合に真を返します。そうでない場合は偽を返します。
従って、特に other が self.kind_of?(other) である場合には Module#=== と同様に真......の他に、 Errno::EXXX::Errno == Errno::EYYY::Errno である場合にも Errno::EXXX == Errno::EYYY.new は真を返します。
エラー名は異なるがエラーコードは同じであるような Errno::EXXX 例外をまとめて捕捉するために Module#=== を上書きしていまし......ラスは一つしか作られないようになりました。そのため現在はこのメソッドは実質上 Module#=== と同じ意味しかありません。
@param other 任意のオブジェクト
例
p Errno::EAGAIN::Errno
p Errno::EWOULDBLOCK::Errno
begin
raise Errno:...