aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-04-24 21:18:21 +0200
committerXavier Noria <fxn@hashref.com>2016-04-24 21:18:21 +0200
commit7463aa19b1a1492bcc6aeb61e3163a893856453c (patch)
tree441e0ee6c51c89eefb080f02f3a3d7f1ad6bf537
parentfe1eda64e506f371224930db3a418bcf07a940f4 (diff)
downloadrails-7463aa19b1a1492bcc6aeb61e3163a893856453c.tar.gz
rails-7463aa19b1a1492bcc6aeb61e3163a893856453c.tar.bz2
rails-7463aa19b1a1492bcc6aeb61e3163a893856453c.zip
rewords code comment [ci skip]
This alternative flows better. [Richard Schneeman & Xavier Noria]
-rw-r--r--activesupport/lib/active_support/core_ext/object/blank.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb
index b08321aeeb..699b2fb42b 100644
--- a/activesupport/lib/active_support/core_ext/object/blank.rb
+++ b/activesupport/lib/active_support/core_ext/object/blank.rb
@@ -110,9 +110,9 @@ class String
#
# @return [true, false]
def blank?
- # In practice, the majority of blank strings are empty. The predicate is
- # about 3.5x faster than the regexp check so we first test empty?, and then
- # fallback. Penalty for the rest of strings is marginal.
+ # The regexp that matches blank strings is expensive. For the case of empty
+ # strings we can speed up this method (~3.5x) with an empty? call. The
+ # penalty for the rest of strings is marginal.
#
# Double negation in the second operand is also a performance tweak, it is
# faster than the positive \A[[:space:]]*\z.