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:
parent
0d44609dfb
commit
e6bac8a8ea
@ -2,6 +2,13 @@ class String
|
|||||||
def undent
|
def undent
|
||||||
gsub(/^.{#{slice(/^ +/).length}}/, '')
|
gsub(/^.{#{slice(/^ +/).length}}/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless String.method_defined?(:start_with?)
|
||||||
|
def start_with? prefix
|
||||||
|
prefix = prefix.to_s
|
||||||
|
self[0, prefix.length] == prefix
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# used by the inreplace function (in utils.rb)
|
# used by the inreplace function (in utils.rb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user