aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/string.rb
diff options
context:
space:
mode:
authorBaptiste Fontaine2014-05-01 01:10:51 +0200
committerAdam Vandenberg2014-05-02 19:50:27 -0700
commit74e4fdfce2e7a2b927c259bf9f977dd6e97643c2 (patch)
tree513c455567db2fab6baccd2072baaf25bcaa2070 /Library/Homebrew/extend/string.rb
parent348d0eb05c9d6482d910ccf0bc0817f872059aef (diff)
downloadbrew-74e4fdfce2e7a2b927c259bf9f977dd6e97643c2.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 Homebrew/homebrew#28873. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Homebrew/extend/string.rb')
-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: