Skip to content
Browse files

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
  • Loading branch information...
1 parent 826f0bd commit 8f68804fba5ac9e3c8ed0b67ef384c888b03a56b @jeremy jeremy committed
Showing with 6 additions and 5 deletions.
  1. +6 −5 activesupport/lib/active_support/json/decoding.rb
View
11 activesupport/lib/active_support/json/decoding.rb
@@ -45,11 +45,12 @@ def convert_json_to_yaml(json) #:nodoc:
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

0 comments on commit 8f68804

Please sign in to comment.
Something went wrong with that request. Please try again.