String#bytesize fix for ruby < 1.8.7 using amqp

This commit is contained in:
Pete Fritchman 2011-02-19 19:03:14 -08:00
parent 4d395c8674
commit 5159f091a3

View file

@ -9,4 +9,13 @@ if !String.instance_methods.include?("start_with?")
end
end
# Ruby 1.8.7 added String#bytesize, used by the latest amqp gem to get the
# size of a string (instead of String#length). This monkeypatch enables older
# ruby to work, but may cause AMQP trouble on UTF-8 strings.
if !String.instance_methods.include?("bytesize")
class String
alias :bytesize :length
end
end
require "logstash/rubyfixes/regexp_union_takes_array"