diff options
author | Diego Carrion <dc.rec1@gmail.com> | 2011-03-09 20:27:29 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-03-22 21:09:54 -0300 |
commit | 7004434ad85901215e1cb4367b2b8b1e7f9063c7 (patch) | |
tree | 2a891065132dea43f267318d9d58cd52f8958c28 /activesupport/lib/active_support | |
parent | 450f7cf01b855b536416fc048a92c4309da2492e (diff) | |
download | rails-7004434ad85901215e1cb4367b2b8b1e7f9063c7.tar.gz rails-7004434ad85901215e1cb4367b2b8b1e7f9063c7.tar.bz2 rails-7004434ad85901215e1cb4367b2b8b1e7f9063c7.zip |
test json decoding with time parsing disabled with all backends and respect ActiveSupport.parse_json_times when converting to yaml
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/json/backends/yaml.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/json/backends/yaml.rb b/activesupport/lib/active_support/json/backends/yaml.rb index 077eda548a..f9d8fd8e83 100644 --- a/activesupport/lib/active_support/json/backends/yaml.rb +++ b/activesupport/lib/active_support/json/backends/yaml.rb @@ -70,9 +70,11 @@ module ActiveSupport left_pos.each_with_index do |left, i| scanner.pos = left.succ chunk = scanner.peek(right_pos[i] - scanner.pos + 1) - # overwrite the quotes found around the dates with spaces - while times.size > 0 && times[0] <= right_pos[i] - chunk.insert(times.shift - scanner.pos - 1, '! ') + if ActiveSupport.parse_json_times + # overwrite the quotes found around the dates with spaces + while times.size > 0 && times[0] <= right_pos[i] + chunk.insert(times.shift - scanner.pos - 1, '! ') + end end chunk.gsub!(/\\([\\\/]|u[[:xdigit:]]{4})/) do ustr = $1 |