11件ヒット
[1-11件を表示]
(0.277秒)
検索結果
-
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"
//}...