aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorSebastian Martinez <sebastian@wyeworks.com>2011-04-17 19:47:46 -0300
committerSebastian Martinez <sebastian@wyeworks.com>2011-04-17 19:47:46 -0300
commitd0635b6ad43dd08fe2fc505388b4cd229e25845f (patch)
treeac4cb3349dba634dc65e1753f7fbea9073ef8e5d /activesupport/lib
parentb14b058be863e5a557191c9b403cc7ebc77951c9 (diff)
downloadrails-d0635b6ad43dd08fe2fc505388b4cd229e25845f.tar.gz
rails-d0635b6ad43dd08fe2fc505388b4cd229e25845f.tar.bz2
rails-d0635b6ad43dd08fe2fc505388b4cd229e25845f.zip
Documented String#blank?
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/object/blank.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb
index 8cef3e87ea..5cf49e2cbf 100644
--- a/activesupport/lib/active_support/core_ext/object/blank.rb
+++ b/activesupport/lib/active_support/core_ext/object/blank.rb
@@ -85,7 +85,13 @@ class Hash
alias_method :blank?, :empty?
end
-class String #:nodoc:
+class String
+ # A string is blank if it's empty or contains whitespaces only
+ # For example:
+ #
+ # "".blank? => true
+ # " ".blank? => true
+ # " something here ".blank? => false
def blank?
self !~ /\S/
end