diff options
| author | Baptiste Fontaine | 2014-05-01 01:10:51 +0200 |
|---|---|---|
| committer | Adam Vandenberg | 2014-05-02 19:50:27 -0700 |
| commit | b3f664c79ffc91080f3b92639ff47f7659ce76d2 (patch) | |
| tree | f24f2a1d17a16a077171f1bea4beda7af9bf958b /Library/Homebrew/extend | |
| parent | 0070c12a9843f9d227473d5b219dc31ad92bfe88 (diff) | |
| download | homebrew-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.rb | 2 |
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: |
