2件ヒット
[1-2件を表示]
(0.032秒)
検索結果
-
BasicObject
# ! -> bool (166.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... -
BasicObject
# ==(other) -> bool (40.0) -
オブジェクトが other と等しければ真を、さもなくば偽を返します。
...list[例][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#equ...