Skip to content

Instantly share code, notes, and snippets.

@yangsu
Created January 28, 2013 03:54
Show Gist options
  • Save yangsu/4652895 to your computer and use it in GitHub Desktop.
Save yangsu/4652895 to your computer and use it in GitHub Desktop.
Ruby Open Classes
class NilClass
def blank?
true
end
end
class String
def blank?
self.size == 0
end
end
["", "person", nil].each do |element|
puts element unless element.blank?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment