るりまサーチ

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

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. io puts
  5. xmp puts

クラス

検索結果

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

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

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

ただし、 BasicObject#!= 自身や BasicObject#! を再定義した際には、ユーザーの責任で
整合性を保た...
...sicObject#!

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

def !=(other)
@count += 1
super
end
end
recorder = NonequalityRecorder.new

recorder != 1
puts
'hoge' if recorder != "str"

p recorder.count #=> 2
//}...