diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-18 21:39:15 +0200 |
---|---|---|
committer | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-18 21:39:15 +0200 |
commit | e019587e31abe66416c0b5d26b6ac177b345a727 (patch) | |
tree | 00b18ceb7f6852ca8a2e76885eb3757f65910917 /activesupport/lib/active_support/json/backends/yajl.rb | |
parent | 3e335923161b4074cb048b2a828b0588fcf98b16 (diff) | |
download | rails-e019587e31abe66416c0b5d26b6ac177b345a727.tar.gz rails-e019587e31abe66416c0b5d26b6ac177b345a727.tar.bz2 rails-e019587e31abe66416c0b5d26b6ac177b345a727.zip |
removed AS backends and instead rely on MultiJson for json decoding
Diffstat (limited to 'activesupport/lib/active_support/json/backends/yajl.rb')
-rw-r--r-- | activesupport/lib/active_support/json/backends/yajl.rb | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/activesupport/lib/active_support/json/backends/yajl.rb b/activesupport/lib/active_support/json/backends/yajl.rb deleted file mode 100644 index 58818658c7..0000000000 --- a/activesupport/lib/active_support/json/backends/yajl.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'yajl' unless defined?(Yajl) - -module ActiveSupport - module JSON - module Backends - module Yajl - ParseError = ::Yajl::ParseError - extend self - - # Parses a JSON string or IO and convert it into an object - def decode(json) - data = ::Yajl::Parser.new.parse(json) - if ActiveSupport.parse_json_times - convert_dates_from(data) - else - data - end - end - - private - def convert_dates_from(data) - case data - when nil - nil - when DATE_REGEX - begin - DateTime.parse(data) - rescue ArgumentError - data - end - 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 - end - end -end |