Created
March 10, 2016 07:20
-
-
Save teebu/3cba0ef79b51f7d7e75a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NilClass | |
def blank? | |
true | |
end | |
def not_blank? | |
!blank? | |
end | |
end | |
class String | |
def blank? | |
self.strip.empty? | |
end | |
def not_blank? | |
!blank? | |
end | |
end | |
class FalseClass | |
def blank? | |
true | |
end | |
def not_blank? | |
!blank? | |
end | |
end | |
class TrueClass | |
def blank? | |
false | |
end | |
def not_blank? | |
!blank? | |
end | |
end | |
class Object | |
def blank? | |
respond_to?(:empty?) ? empty? : !self | |
end | |
def not_blank? | |
!blank? | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment