Skip to content

Instantly share code, notes, and snippets.

@ymendel
Created May 28, 2010 22:34
Show Gist options
  • Select an option

  • Save ymendel/417845 to your computer and use it in GitHub Desktop.

Select an option

Save ymendel/417845 to your computer and use it in GitHub Desktop.
class Object
def to_bool
TrueClass === self
end
end
class Numeric
def to_bool
return false if self == 0
return true
end
end
class Float
def to_bool
return false if self == 0.0
return true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment