From 8f68804fba5ac9e3c8ed0b67ef384c888b03a56b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 29 Sep 2007 21:27:29 +0000 Subject: JSON decoding Ruby 1.9 compat. Mark a section that's unnecessarily slow. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7678 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/json/decoding.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/json/decoding.rb b/activesupport/lib/active_support/json/decoding.rb index b6370ddb0e..cb5f2a222a 100644 --- a/activesupport/lib/active_support/json/decoding.rb +++ b/activesupport/lib/active_support/json/decoding.rb @@ -45,11 +45,12 @@ module ActiveSupport if marks.empty? json else - ranges = ([0] + marks.map(&:succ)).zip(marks + [json.length]) - output = ranges.collect! { |(left, right)| json[left..right] }.join(" ") - times.each do |pos| - output[pos-1] = ' ' - end + # FIXME: multiple slow enumerations + output = ([0] + marks.map(&:succ)). + zip(marks + [json.length]). + map { |left, right| json[left..right] }. + join(" ") + times.each { |pos| output[pos-1] = ' ' } output end end -- cgit v1.2.3