るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

検索結果

BasicObject#! -> bool (8022.0)

オブジェクトを真偽値として評価し、その論理否定を返します。

...order < BasicObject
def initialize
@count = 0
end
attr_reader
:count

def !
@count += 1
super
end
end

recorder = NegationRecorder.new
!recorder
!!!!!!!recorder
puts 'hoge' if !recorder

puts recorder.count #=> 3
//}

//emlist[例][ruby]{
class AnotherFalse < BasicObject
def...
...!
true
end
end
another_false = AnotherFalse.new

# another_falseは**
puts "another false is a truth" if another_false
#=> "another false is a truth"
//}...