Skip to content

Instantly share code, notes, and snippets.

@SergXIIIth
Created February 10, 2014 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SergXIIIth/8912833 to your computer and use it in GitHub Desktop.
Save SergXIIIth/8912833 to your computer and use it in GitHub Desktop.
class Object
def blank?
self.nil?
end
def present?
!blank?
end
end
class String
def blank?
if self =~ /\S+/i # Any non-whitespace character
false
else
true
end
end
def present?
!blank?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment