don't quote floats
This commit is contained in:
parent
3c4ec6d39d
commit
e38a136c49
2 changed files with 4 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ module SplunkLogging
|
||||||
if hash.respond_to?(:keys)
|
if hash.respond_to?(:keys)
|
||||||
string = ''
|
string = ''
|
||||||
hash.each_pair do |key, value|
|
hash.each_pair do |key, value|
|
||||||
if(value.instance_of?(Symbol)||value.instance_of?(Fixnum))
|
if(value.instance_of?(Symbol)||value.instance_of?(Fixnum)||value.instance_of?(Float))
|
||||||
string << "#{key}=#{value} "
|
string << "#{key}=#{value} "
|
||||||
else
|
else
|
||||||
string << "#{key}='#{value}' "
|
string << "#{key}='#{value}' "
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,8 @@ describe SplunkLogging do
|
||||||
it 'does not quote numbers' do
|
it 'does not quote numbers' do
|
||||||
format_hash({:key => 500 }).should =~ /=500/
|
format_hash({:key => 500 }).should =~ /=500/
|
||||||
end
|
end
|
||||||
|
it 'does not quote floats' do
|
||||||
|
format_hash({:key => 2.324}).should =~ /=2.324/
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue