るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

検索結果

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

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

...トの同一性になっています。

@
param other 比較対象となるオブジェクト
@
return other が self と同値であれば真、さもなくば偽

//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#==, Object#equal?,
Object#eql?...

BasicObject#!=(other) -> bool (144.0)

オブジェクトが other と等しくないことを判定します。

...トでは self == other を評価した後に結果を論理否定して返します。
このため、サブクラスで BasicObject#== を再定義しても != とは自動的に整合性が
とれるようになっています。

ただし、 BasicObject#!= 自身や BasicObject#! を再定義...
...のと想定されています。

@
param other 比較対象となるオブジェクト
@
see BasicObject#==, BasicObject#!

//emlist[例][ruby]{
class NonequalityRecorder < BasicObject
def initialize
@
count = 0
end
attr_reader :count

def !=(other)
@
count += 1
super
end
end
rec...