Class Index [+]

Quicksearch

ActiveSupport::JSON::Backends::Yajl

Constants

ParseError

Public Instance Methods

decode(json) click to toggle source

Parses a JSON string or IO and convert it into an object

    # File lib/active_support/json/backends/yajl.rb, line 11
11:         def decode(json)
12:           data = ::Yajl::Parser.new.parse(json)
13:           if ActiveSupport.parse_json_times
14:             convert_dates_from(data)
15:           else
16:             data
17:           end
18:         end

Private Instance Methods

convert_dates_from(data) click to toggle source
    # File lib/active_support/json/backends/yajl.rb, line 21
21:         def convert_dates_from(data)
22:           case data
23:           when nil
24:             nil
25:           when DATE_REGEX
26:             DateTime.parse(data)
27:           when Array
28:             data.map! { |d| convert_dates_from(d) }
29:           when Hash
30:             data.each do |key, value|
31:               data[key] = convert_dates_from(value)
32:             end
33:           else
34:             data
35:           end
36:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.