diff options
| author | Adam Vandenberg | 2011-06-13 13:02:17 -0700 | 
|---|---|---|
| committer | Adam Vandenberg | 2011-06-19 21:32:37 -0700 | 
| commit | e6bac8a8eadcd01e1df314fb17e5be9ae4036f3c (patch) | |
| tree | 665539489768e72bd75c1ac6135a5d881d6836f3 /Library | |
| parent | 0d44609dfb046c673ff2f745d2287ed9734791fa (diff) | |
| download | brew-e6bac8a8eadcd01e1df314fb17e5be9ae4036f3c.tar.bz2 | |
back-port start_with? from 1.8.7
This allows its use in Leopard, which has Ruby 1.8.6.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/string.rb | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb index 57630a701..0246f0c90 100644 --- a/Library/Homebrew/extend/string.rb +++ b/Library/Homebrew/extend/string.rb @@ -2,6 +2,13 @@ class String    def undent      gsub(/^.{#{slice(/^ +/).length}}/, '')    end + +  unless String.method_defined?(:start_with?) +    def start_with? prefix +      prefix = prefix.to_s +      self[0, prefix.length] == prefix +    end +  end  end  # used by the inreplace function (in utils.rb)  | 
