るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Exception#==(other) -> bool (29136.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 => e
e...
...ception { 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] == re...

Rational#==(other) -> bool (29132.0)

数値として等しいか判定します。

...なければ 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
//}...
...でなければ 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 (29126.0)

other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

...other が文字列の場合、String#eql? と同様に文字列の内容を比較します。

other が文字列でない場合、
other.to_str が定義されていれば
other == self の結果を返します。(ただし、 other.to_str は実行されません。)
そうでなければ 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#e...

BasicObject#==(other) -> bool (29114.0)

オブジェクトが other と等しければ真を、さもなくば偽を返します。

...//emlist[例][ruby]{
class Person < BasicObject
def initialize(name, age)
@name = 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#==, Obje...

Integer#==(other) -> bool (29114.0)

比較演算子。数値として等しいか判定します。

...比較演算子。数値として等しいか判定します。

@param other 比較対象の数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。

//emlist[][ruby]{
1 == 2 # => false
1 == 1.0 # => true
//}...

絞り込み条件を変える

Bignum#==(other) -> bool (29102.0)

比較演算子。数値として等しいか判定します。

比較演算子。数値として等しいか判定します。

@param other 比較対象の数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。

Enumerator::ArithmeticSequence#==(other) -> bool (29102.0)

Enumerable::ArithmeticSequence として等しいか判定します。

...Enumerable::ArithmeticSequence として等しいか判定します。

other が Enumerable::ArithmeticSequence で
begin, end, step, exclude_end? が等しい時に
true を返します。

@param other 自身と比較する Enumerable::ArithmeticSequence...

Fixnum#==(other) -> bool (29102.0)

比較演算子。数値として等しいか判定します。

比較演算子。数値として等しいか判定します。

@param other 比較対象の数値
@return self と other が等しい場合 true を返します。
そうでなければ false を返します。

Regexp#==(other) -> bool (26132.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
//}...

Process::Status#==(other) -> bool (26108.0)

同じステータスの場合に真を返します。

...同じステータスの場合に真を返します。

other が数値の場合、self.to_i との比較が行われます。こ
れは後方互換性のためです。

@param other 自身と比較したいオブジェクトを指定します。...

絞り込み条件を変える

Enumerable#find_index {|obj| ... } -> Integer | nil (20368.0)

条件に一致する最初の要素の位置を返します。

...トを指定します。

指定された val と == で等しい最初の要素の位置を返します。
等しい要素がひとつもなかった場合は nil を返します。

//emlist[例][ruby]{
(1..10).find_index(11) #=> nil
(1..10).find_index(2) #=> 1
//}

ブロックが与えられ...
...の位置を返します。
一つも真にならなかった場合は nil を返します。

//emlist[例][ruby]{
(1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
(1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
//}

引数、ブロックのどちらも与えられなか...
<< 1 2 3 ... > >>