Google

def Functions::boolean( object=nil ) if object.kind_of? String if object =~ /\d+/u return object.to_f != 0 else return object.size > 0 end elsif object.kind_of? Array object = object.find{|x| x and true} end return object ? true : false end