別のキーワード
種類
- インスタンスメソッド (1274)
- 特異メソッド (153)
- モジュール関数 (55)
- クラス (44)
- モジュール (22)
クラス
- Array (218)
- BasicObject (11)
- Complex (11)
- Data (8)
- Enumerator (23)
-
Enumerator
:: Lazy (43) - Exception (22)
- FalseClass (33)
- File (11)
- Hash (82)
- KeyError (7)
- Method (33)
- Module (11)
- Numeric (55)
- Object (55)
- Proc (55)
-
Process
:: Status (11) - Random (33)
- Range (32)
- Regexp (33)
-
RubyVM
:: InstructionSequence (22) - String (252)
- Struct (22)
- Symbol (22)
- SystemCallError (11)
- Thread (22)
- Time (44)
- TrueClass (33)
- UnboundMethod (33)
モジュール
- Comparable (11)
- Enumerable (102)
- Process (11)
-
Process
:: GID (22) -
Process
:: UID (22)
オブジェクト
- ENV (66)
キーワード
- != (11)
- % (11)
- & (22)
- === (66)
- GID (11)
- Lazy (11)
- Numeric (11)
- String (11)
- Symbol (11)
- UID (11)
- [] (77)
- ^ (22)
- assoc (11)
-
backtrace
_ locations (11) - call (11)
-
chunk
_ while (11) - clone (11)
- crypt (11)
- dedup (2)
- define (4)
- delete (22)
-
delete
_ if (22) - detect (22)
- disasm (11)
- disassemble (11)
- div (11)
- downcase (8)
- dump (11)
- dup (11)
- each (22)
-
each
_ key (22) -
each
_ pair (22) - eql? (68)
- find (22)
-
find
_ index (33) - getgm (11)
- getlocal (22)
- getrlimit (11)
- getutc (11)
- group (11)
-
has
_ value? (11) - hash (33)
- id2name (11)
- include? (5)
- index (33)
- intern (11)
-
keep
_ if (22) - key (7)
- lazy (22)
- lstat (11)
- map (11)
-
marshal
_ dump (11) -
marshal
_ load (11) - member? (5)
- modulo (11)
- new (34)
- none? (13)
- one? (13)
- pack (19)
- partition (22)
-
pending
_ interrupt? (11) - produce (5)
- rassoc (11)
- reject! (22)
- remainder (11)
- rindex (33)
- select! (10)
- slice (66)
-
slice
_ after (10) -
slice
_ before (11) - split (17)
- switch (44)
-
to
_ h (17) -
to
_ hash (11) -
to
_ proc (11) -
to
_ s (11) -
to
_ sym (11) - unpack (11)
- value? (11)
- yield (11)
- | (22)
検索結果
先頭5件
-
Exception
# ==(other) -> bool (21160.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...身と指定された other のクラスが同じであり、
message と backtrace が == メソッドで比較して
等しい場合に true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。......定した場合は
Exception#exception を実行して変換を試みます。
//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 =......ap { |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... -
Regexp
# ==(other) -> bool (21156.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$/) # => tru... -
Complex
# ==(other) -> bool (21120.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 (21114.0) -
比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が 0 を返した時に、true を返します。 それ以外を返した場合は、false を返します。
...ジェクト同士を比較します。
<=> が 0 を返した時に、true を返します。
それ以外を返した場合は、false を返します。
@param other 自身と比較したいオブジェクトを指定します。
//emlist[例][ruby]{
1 == 1 # => true
1 == 2 # => false
//}... -
Process
:: Status # ==(other) -> bool (21102.0) -
同じステータスの場合に真を返します。
...同じステータスの場合に真を返します。
other が数値の場合、self.to_i との比較が行われます。こ
れは後方互換性のためです。
@param other 自身と比較したいオブジェクトを指定します。... -
Data
# ==(other) -> bool (18160.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?... -
Range
# ==(other) -> bool (18154.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
//}... -
Object
# ==(other) -> bool (18150.0) -
オブジェクトと other が等しければ真を返します。
...ォルトでは equal? と同じオブジェクト
の同一性判定になっています。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
p("foo" == "bar") #=> false
p("foo" == "foo") #=> true
p(4 == 4) #=> true
p(4 == 4.0) #=> true
//}
@see Object#equal?,Object#eql?... -
String
# ==(other) -> bool (18150.0) -
other が文字列の場合、String#eql? と同様に文字列の内容を比較します。
... == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ false を返します。
@param 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?(stringlike) #=> false
p "string" == stringlike #=> true
//}
@see String#eql?... -
Struct
# ==(other) -> bool (18142.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 の下位クラスのインスタンスに対して呼び
出す...