From: Ryan Davis Date: 2011-12-07T20:46:27+09:00 Subject: Re: Ruby way to define binary On Dec 6, 2011, at 12:05 , Misha Ognev wrote: > hi2all > > I have some trouble. How can i define the binary of value in ruby? (I > have a value, and I want to know that's it true or false). You don't really need to. Everything in ruby has a "truthiness" to it and can be used in logical expressions. Only nil and false are "falsey" and everything else are "truthy". In other words, just use objects and they'll take care of you. if var then do_something end If you feel REALLY insecure about typing in a dynamic language you can always double-negate: class Object def truthy? !!self end end if var.truthy? then # wasted cycles for no gain do_something end