Say I have the following:
class Foo
def inspect
false
end
def ==(other)
false == other
end
end
foo = Foo.new # => false
foo # => false
foo == false # => true
foo == true # => false
However
if foo then 'hi' end
# => 'hi'
What I was expecting was
if false then 'hi' end
# => nil
I was expecting foo
to evaluate as false
but it's not. How is if
evaluating foo
and why is it not false
?