Skip to content

Commit

Permalink
- Add backport monkeypatches for String#start_with?
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Nov 23, 2010
1 parent 03068fc commit 5cb19a5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/logstash/inputs.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

require "logstash/namespace"
require "logstash/ruby_fixes"
require "uri"

module LogStash::Inputs
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/logging.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "logstash/namespace"
require "logstash/ruby_fixes"
require "logger"

class LogStash::Logger < Logger
Expand Down
12 changes: 12 additions & 0 deletions lib/logstash/ruby_fixes.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5cb19a5

Please sign in to comment.