Project

General

Profile

Bug #14719 » simple_delegator_on_boolean_with_equals_override.rb

theirishpenguin (Declan McGrath), 04/27/2018 04:16 PM

 
#!/usr/bin/env ruby

class BoldBool < SimpleDelegator
def equal?(obj)
if __getobj__.is_a? FalseClass and obj == false
return true
else
__getobj__.equal?(obj)
end
end
end

false_bool = BoldBool.new(false)

if false_bool
puts "I'm evaluated as true but I should be false."
end
(2-2/3)