るりまサーチ

最速Rubyリファレンスマニュアル検索!
1548件ヒット [1-100件を表示] (0.083秒)

別のキーワード

  1. openssl p=
  2. openssl p
  3. fileutils mkdir_p
  4. dh p=
  5. dh p

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

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 の下位クラスのインスタンスに対して呼び
出す...

絞り込み条件を変える

<< 1 2 3 ... > >>