Skip to content

Instantly share code, notes, and snippets.

@acuppy
Last active December 20, 2015 01:18
Show Gist options
  • Save acuppy/6047554 to your computer and use it in GitHub Desktop.
Save acuppy/6047554 to your computer and use it in GitHub Desktop.
Object#true? and Object#false? boolean assertions
class Object
def true?
self.respond_to?( :to_i ) ? !self.to_i.zero? : true
end
def false?
!true?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment