るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

ライブラリ

クラス

検索結果

Struct#eql?(other) -> bool (54418.0)

self と other のクラスが同じであり、各メンバが eql? メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。

self と other のクラスが同じであり、各メンバが eql? メソッドで比較して等しい場合に
true を返します。そうでない場合に false を返します。

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

//emlist[例][ruby]{
Dog = Struct.new(:name, :age)
dog1 = Dog.new("fred", 5)
dog2 = Dog.new("fred", 5)

p dog1 == dog2 #=> true
p dog1.eql?(dog2) #=> ...

OpenStruct#eql?(other) -> bool (54388.0)

self と other が等しい場合に true を返します。そうでない場合は false を 返します。

self と other が等しい場合に true を返します。そうでない場合は false を
返します。

具体的には other が OpenStruct オブジェクトかそのサブクラスでかつ、
self の各要素を保持した内部の Hash が eql? で比較して等しい場合に
true を返します。

@param other 比較対象のオブジェクトを指定します。

Gem::Version#eql?(other) -> bool (54352.0)

self と other の Gem::Version#version のバージョンが等しいとき true を返します。 そうでなければ false を返します。

self と other の Gem::Version#version のバージョンが等しいとき true を返します。
そうでなければ false を返します。

Comparable を include して作られた == と異なり、"1.0" と "1" は異なるものと判定します。

//emlist[][ruby]{
ver0 = Gem::Version.create('1.0') # #<Gem::Version "1.0">
ver1 = Gem::Version.create('1.0') # #<Gem::Version "1.0">
ver2 = Gem::Ver...

BigDecimal#eql?(other) -> bool (45352.0)

self が other と等しい場合に true を、そうでない場合に false を返します。

self が other と等しい場合に true を、そうでない場合に false を返します。

それぞれの値は BigDecimal#coerce で変換して比較される場合があります。

//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('1.0') == 1.0 # => true
//}

MatchData#eql?(other) -> bool (45352.0)

self と other のマッチ対象になった文字列、元になった正規表現オブジェク ト、マッチした位置が等しければ true を返します。そうでない場合には false を返します。

self と other のマッチ対象になった文字列、元になった正規表現オブジェク
ト、マッチした位置が等しければ 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
//}

//emlist[正規表現][ruby]{
r = /abc/
m1 = r.mat...

絞り込み条件を変える

String#hash -> Integer (100.0)

self のハッシュ値を返します。 eql? で等しい文字列は、常にハッシュ値も等しくなります。

self のハッシュ値を返します。
eql? で等しい文字列は、常にハッシュ値も等しくなります。

//emlist[例][ruby]{
"test".hash # => 4038258770210371295
("te" + "st").hash == "test".hash # => true
//}

@see Hash