>>312 Ruby
def i2b( x )
if x.is_a?( Integer )
return false if x == 0
return true if x == 1
end
x
end

[ 'foo', 7, 1, 1.0, [], true, false, 0, {} ].each{|x|
puts "%5p : %5p" % [x, i2b( x )]
}
# =>
"foo" : "foo"
7 : 7
1 : true
1.0 : 1.0
[] : []
true : true
false : false
0 : false
0 : false
{} : {}