Permalink
Browse files

Merge pull request #12976 from tmm1/faster-blank

Faster String#blank?
  • Loading branch information...
fxn committed Nov 21, 2013
2 parents 64b9e93 + 30ba7ee commit 9b423c98118c8900ee0bc4bfcf1f8eb1ad0632d5
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/object/blank.rb
@@ -90,7 +90,7 @@ class String
# ' '.blank? # => true
# ' something here '.blank? # => false
def blank?
- self !~ /[^[:space:]]/
+ self =~ /\A[[:space:]]*\z/
end
end

0 comments on commit 9b423c9

Please sign in to comment.