From 92a7ad52628c6178715a36dcb270fe6fa87f2c46 Mon Sep 17 00:00:00 2001 From: Cheah Chu Yeow Date: Wed, 13 May 2009 01:33:31 +0800 Subject: [PATCH] Use string interpolation instead of concatenation in Hash#rails_to_json. --- .../lib/active_support/json/encoders/hash.rb | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/json/encoders/hash.rb b/activesupport/lib/active_support/json/encoders/hash.rb index 4771484..a071620 100644 --- a/activesupport/lib/active_support/json/encoders/hash.rb +++ b/activesupport/lib/active_support/json/encoders/hash.rb @@ -42,10 +42,8 @@ class Hash end end - result = '{' - result << hash_keys.map do |key| + "{#{hash_keys.map do |key| "#{ActiveSupport::JSON.encode(key.to_s)}:#{ActiveSupport::JSON.encode(self[key], options, *args)}" - end * ',' - result << '}' + end * ','}}" end end -- 1.6.1