aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2011-06-13 13:02:17 -0700
committerAdam Vandenberg2011-06-19 21:32:37 -0700
commit75760b24e733b918549ad357a90d712dda03336f (patch)
treee6ff3274585724ad5a03fac559891ea339a883a6 /Library
parent3f7ee57c06b7dd81d9d973d782b84d0aae299f1c (diff)
downloadhomebrew-75760b24e733b918549ad357a90d712dda03336f.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.rb7
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)