Sha256: b43e71a56fdd9bed2cd4db61a51d3eeda6e71e9524a7063610cd7ceca1754916
Contents?: true
Size: 882 Bytes
Versions: 26
Compression:
Stored size: 882 Bytes
Contents
require 'json' unless defined?(JSON) module ActiveSupport module JSON ParseError = ::JSON::ParserError unless const_defined?(:ParseError) module Backends module JSONGem extend self # Converts a JSON string into a Ruby object. def decode(json) data = ::JSON.parse(json) if ActiveSupport.parse_json_times convert_dates_from(data) else data end end 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 end end end end end end
Version data entries
26 entries across 25 versions & 7 rubygems