るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

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

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

...mlist[例][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#eq...

BasicObject#!=(other) -> bool (26.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...