aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorBaptiste Fontaine2014-05-01 01:10:51 +0200
committerAdam Vandenberg2014-05-02 19:50:27 -0700
commitb3f664c79ffc91080f3b92639ff47f7659ce76d2 (patch)
treef24f2a1d17a16a077171f1bea4beda7af9bf958b /Library/Homebrew/extend
parent0070c12a9843f9d227473d5b219dc31ad92bfe88 (diff)
downloadhomebrew-b3f664c79ffc91080f3b92639ff47f7659ce76d2.tar.bz2
Fix for String#undent
Without it, String#undent would fail on unindented strings, e.g.: "foo".undent NoMethodError: undefined method `length' for nil:NilClass` Closes #28873. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/string.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb
index 56126e247..c0f5ae1db 100644
--- a/Library/Homebrew/extend/string.rb
+++ b/Library/Homebrew/extend/string.rb
@@ -1,6 +1,6 @@
class String
def undent
- gsub(/^.{#{slice(/^ +/).length}}/, '')
+ gsub(/^.{#{(slice(/^ +/) || '').length}}/, '')
end
# eg: