Merge pull request #559 from bobtfish/event_sprintf_fixnums

Small fix for logstash/event.rb's sprintf method.
This commit is contained in:
Jordan Sissel 2013-08-16 15:22:18 -07:00
commit 82ca42f3dd
2 changed files with 5 additions and 0 deletions

View file

@ -205,6 +205,7 @@ class LogStash::Event
# is an array (or hash?) should be. Join by comma? Something else?
public
def sprintf(format)
format = format.to_s
if format.index("%").nil?
return format
end

View file

@ -45,6 +45,10 @@ describe LogStash::Event do
insist { subject.sprintf("%{[j][k1]}") } == "v"
insist { subject.sprintf("%{[j][k2][0]}") } == "w"
end
it "should be able to take a non-string for the format" do
insist { subject.sprintf(2) } == "2"
end
end
context "#[]" do