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

Changeset 8505

Show
Ignore:
Timestamp:
12/28/07 18:37:17 (6 months ago)
Author:
rick
Message:

remove multiple enumerations from ActiveSupport::JSON#convert_json_to_yaml when dealing with date/time values. [rick]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/CHANGELOG

    r8454 r8505  
    11*SVN* 
     2 
     3* remove multiple enumerations from ActiveSupport::JSON#convert_json_to_yaml when dealing with date/time values.  [rick] 
    24 
    35* Hash#symbolize_keys skips keys that can't be symbolized.  #10500 [Brad Greenlee] 
  • trunk/activesupport/lib/active_support/json/decoding.rb

    r8026 r8505  
    4646            json.gsub(/\\\//, '/') 
    4747          else 
    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(" ") 
     48            left_pos  = [-1].push(*marks) 
     49            right_pos = marks << json.length 
     50            output    = [] 
     51            left_pos.each_with_index do |left, i| 
     52              output << json[left.succ..right_pos[i]] 
     53            end 
     54            output = output * " " 
     55             
    5356            times.each { |i| output[i-1] = ' ' } 
    5457            output.gsub!(/\\\//, '/')