diff --git a/lib/logstash/inputs.rb b/lib/logstash/inputs.rb index e7e9f965902..1253114b546 100644 --- a/lib/logstash/inputs.rb +++ b/lib/logstash/inputs.rb @@ -1,5 +1,6 @@ require "logstash/namespace" +require "logstash/ruby_fixes" require "uri" module LogStash::Inputs diff --git a/lib/logstash/logging.rb b/lib/logstash/logging.rb index 6c24e94b69d..d54a4479ed1 100644 --- a/lib/logstash/logging.rb +++ b/lib/logstash/logging.rb @@ -1,4 +1,5 @@ require "logstash/namespace" +require "logstash/ruby_fixes" require "logger" class LogStash::Logger < Logger diff --git a/lib/logstash/ruby_fixes.rb b/lib/logstash/ruby_fixes.rb new file mode 100644 index 00000000000..08751c0eb8a --- /dev/null +++ b/lib/logstash/ruby_fixes.rb @@ -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 +