MultiJson::Adapters::JsonCommon

Public Instance Methods

dump(object, options={}) click to toggle source
# File lib/multi_json/adapters/json_common.rb, line 10
def dump(object, options={})
  object.to_json(process_options(options))
end
load(string, options={}) click to toggle source
# File lib/multi_json/adapters/json_common.rb, line 5
def load(string, options={})
  string = string.read if string.respond_to?(:read)
  ::JSON.parse(string, :symbolize_names => options[:symbolize_keys])
end

Protected Instance Methods

process_options(options={}) click to toggle source
# File lib/multi_json/adapters/json_common.rb, line 16
def process_options(options={})
  return options if options.empty?
  opts = {}
  opts.merge!(JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
  opts.merge!(options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.