mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Add backport monkeypatches for String#start_with?
This commit is contained in:
parent
03068fcaf3
commit
5cb19a59d4
3 changed files with 14 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
|
||||
require "logstash/namespace"
|
||||
require "logstash/ruby_fixes"
|
||||
require "uri"
|
||||
|
||||
module LogStash::Inputs
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require "logstash/namespace"
|
||||
require "logstash/ruby_fixes"
|
||||
require "logger"
|
||||
|
||||
class LogStash::Logger < Logger
|
||||
|
|
12
lib/logstash/ruby_fixes.rb
Normal file
12
lib/logstash/ruby_fixes.rb
Normal 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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue