mirror of
https://github.com/gosticks/brew.git
synced 2026-08-12 20:50:29 +00:00
back-port start_with? from 1.8.7
This allows its use in Leopard, which has Ruby 1.8.6.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user