Hi Rubyists,

Is it possible to somehow ducktype an object so that it behaves like a
boolean object (ie true or false)?

The problem I'm having at the moment is that I'd like to have a
modified boolean value so that instead of returning "true" or "false",
my objects to_s returns "1" when true and "0" when false. I've tried
the following

@myTrue = true
def @myTrue.to_s
	return "1"
end

however creating an anonymous class doesn't seem to be allowed and
this affected the results of the original true instance (it now
returns "1" as well) which I'd prefer stayed untouched.

I thought of using numbers such as 1 for true but 0 is not false in a
boolean expression.

So is there a way to create an object that acts like a true or false
when in boolean expression but still be modified without changing the
true or false global objects? Or is there any function called in the
evaluation of boolean expresssions which would allow me to ducktype a
modified object?

Thanks in advance,
Farrel