From e38a136c492e70c6bd64b6b244514db2c882832c Mon Sep 17 00:00:00 2001 From: Raphael Sofaer <raphael@joindiaspora.com> Date: Wed, 9 Mar 2011 15:28:08 -0800 Subject: [PATCH] don't quote floats --- lib/splunk_logging.rb | 2 +- spec/lib/splunk_logging_spec.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/splunk_logging.rb b/lib/splunk_logging.rb index 91a891040d..39f58763f2 100644 --- a/lib/splunk_logging.rb +++ b/lib/splunk_logging.rb @@ -11,7 +11,7 @@ module SplunkLogging if hash.respond_to?(:keys) string = '' 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} " else string << "#{key}='#{value}' " diff --git a/spec/lib/splunk_logging_spec.rb b/spec/lib/splunk_logging_spec.rb index f724ab641a..f2fa5204f6 100644 --- a/spec/lib/splunk_logging_spec.rb +++ b/spec/lib/splunk_logging_spec.rb @@ -17,5 +17,8 @@ describe SplunkLogging do it 'does not quote numbers' do format_hash({:key => 500 }).should =~ /=500/ end + it 'does not quote floats' do + format_hash({:key => 2.324}).should =~ /=2.324/ + end end end -- GitLab