- Add backport monkeypatches for String#start_with?

This commit is contained in:
Jordan Sissel 2010-11-23 13:37:15 -08:00
parent 03068fcaf3
commit 5cb19a59d4
3 changed files with 14 additions and 0 deletions

View file

@ -1,5 +1,6 @@
require "logstash/namespace"
require "logstash/ruby_fixes"
require "uri"
module LogStash::Inputs

View file

@ -1,4 +1,5 @@
require "logstash/namespace"
require "logstash/ruby_fixes"
require "logger"
class LogStash::Logger < Logger

View file

@ -0,0 +1,12 @@
# Ruby 1.8.7 added String#start_with? - monkeypatch the
# String class if it isn't supported (<= ruby 1.8.6)
if !String.instance_methods.include?("start_with?")
class String
def start_with?(str)
return self[0 .. (str.length-1)] == str
end
end
end