diff options
author | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-17 19:47:46 -0300 |
---|---|---|
committer | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-17 19:47:46 -0300 |
commit | d0635b6ad43dd08fe2fc505388b4cd229e25845f (patch) | |
tree | ac4cb3349dba634dc65e1753f7fbea9073ef8e5d /activesupport/lib/active_support | |
parent | b14b058be863e5a557191c9b403cc7ebc77951c9 (diff) | |
download | rails-d0635b6ad43dd08fe2fc505388b4cd229e25845f.tar.gz rails-d0635b6ad43dd08fe2fc505388b4cd229e25845f.tar.bz2 rails-d0635b6ad43dd08fe2fc505388b4cd229e25845f.zip |
Documented String#blank?
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/blank.rb | 8 |
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 |