るりまサーチ

最速Rubyリファレンスマニュアル検索!
6件ヒット [1-6件を表示] (0.006秒)
トップページ > クラス:Struct[x] > クエリ:==[x]

関連するキーワード

  1. _builtin
  2. _builtin
  3. rexml
  4. openssl
  5. matrix

ライブラリ

検索結果

Struct#==(other) -> bool (18123)

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

...ラスが同じであり、各メンバが == メソッドで比較して等しい場合に
true を返します。そうでない場合に false を返します。

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

Dog = Struct.new(: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

@see Struct#eql?...

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

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

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

Dog = Struct.new(: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

@see Struct#==...