mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
Merge pull request #559 from bobtfish/event_sprintf_fixnums
Small fix for logstash/event.rb's sprintf method.
This commit is contained in:
commit
82ca42f3dd
2 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue