Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7678

Show
Ignore:
Timestamp:
09/29/07 21:27:29 (1 year ago)
Author:
bitsweat
Message:

JSON decoding Ruby 1.9 compat. Mark a section that's unnecessarily slow.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/json/decoding.rb

    r7613 r7678  
    4646            json 
    4747          else 
    48             ranges = ([0] + marks.map(&:succ)).zip(marks + [json.length]) 
    49             output = ranges.collect! { |(left, right)| json[left..right] }.join(" ") 
    50             times.each do |pos| 
    51               output[pos-1] = ' ' 
    52             end 
     48            # FIXME: multiple slow enumerations 
     49            output = ([0] + marks.map(&:succ)). 
     50                      zip(marks + [json.length]). 
     51                      map { |left, right| json[left..right] }. 
     52                      join(" ") 
     53            times.each { |pos| output[pos-1] = ' ' } 
    5354            output 
    5455          end