remove multiple enumerations from ActiveSupport::JSON#convert_json_to_yaml when dealing with date/time values. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8505 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
0e3a54a3b9
commit
9e2536393e
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* remove multiple enumerations from ActiveSupport::JSON#convert_json_to_yaml when dealing with date/time values. [rick]
|
||||
|
||||
* Hash#symbolize_keys skips keys that can't be symbolized. #10500 [Brad Greenlee]
|
||||
|
||||
* Ruby 1.9 compatibility. #1689, #10466, #10468, #10554 [Cheah Chu Yeow, Pratik Naik, Jeremy Kemper, Dirkjan Bussink]
|
||||
|
@ -45,11 +45,14 @@ def convert_json_to_yaml(json) #:nodoc:
|
||||
if marks.empty?
|
||||
json.gsub(/\\\//, '/')
|
||||
else
|
||||
# FIXME: multiple slow enumerations
|
||||
output = ([0] + marks.map(&:succ)).
|
||||
zip(marks + [json.length]).
|
||||
map { |left, right| json[left..right] }.
|
||||
join(" ")
|
||||
left_pos = [-1].push(*marks)
|
||||
right_pos = marks << json.length
|
||||
output = []
|
||||
left_pos.each_with_index do |left, i|
|
||||
output << json[left.succ..right_pos[i]]
|
||||
end
|
||||
output = output * " "
|
||||
|
||||
times.each { |i| output[i-1] = ' ' }
|
||||
output.gsub!(/\\\//, '/')
|
||||
output
|
||||
|
Loading…
Reference in New Issue
Block a user