diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-08 21:55:43 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-08 22:02:57 -0800 |
commit | 20cdaddfd27dfeef5c853e85fafa4e13b6da05f3 (patch) | |
tree | 6a102d87cb71ac8fbc7dafeee2ed7e185d68b90d /activesupport/lib/active_support/json | |
parent | 7ad461b44dabb586fbad190493ac4ecd96104597 (diff) | |
download | rails-20cdaddfd27dfeef5c853e85fafa4e13b6da05f3.tar.gz rails-20cdaddfd27dfeef5c853e85fafa4e13b6da05f3.tar.bz2 rails-20cdaddfd27dfeef5c853e85fafa4e13b6da05f3.zip |
Ruby 1.9.2: work around changes to flatten and nil.to_str
Diffstat (limited to 'activesupport/lib/active_support/json')
-rw-r--r-- | activesupport/lib/active_support/json/backends/jsongem.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/activesupport/lib/active_support/json/backends/jsongem.rb b/activesupport/lib/active_support/json/backends/jsongem.rb index c6c17a3c4e..cfe28d7bb9 100644 --- a/activesupport/lib/active_support/json/backends/jsongem.rb +++ b/activesupport/lib/active_support/json/backends/jsongem.rb @@ -23,15 +23,18 @@ module ActiveSupport private def convert_dates_from(data) case data - when DATE_REGEX - DateTime.parse(data) - when Array - data.map! { |d| convert_dates_from(d) } - when Hash - data.each do |key, value| - data[key] = convert_dates_from(value) - end - else data + when nil + nil + when DATE_REGEX + DateTime.parse(data) + when Array + data.map! { |d| convert_dates_from(d) } + when Hash + data.each do |key, value| + data[key] = convert_dates_from(value) + end + else + data end end end |