# File lib/multi_json/adapters/nsjsonserialization.rb, line 21 21: def self.dump(object, options={}) 22: pretty = options[:pretty] ? NSJSONWritingPrettyPrinted : 0 23: object = object.as_json if object.respond_to?(:as_json) 24: if NSJSONSerialization.isValidJSONObject(object) 25: data = NSJSONSerialization.dataWithJSONObject(object, options: pretty, error: nil) 26: NSMutableString.alloc.initWithData(data, encoding: NSUTF8StringEncoding) 27: else 28: super(object, options) 29: end 30: end
# File lib/multi_json/adapters/nsjsonserialization.rb, line 9 9: def self.load(string, options={}) 10: string = string.read if string.respond_to?(:read) 11: data = string.dataUsingEncoding(NSUTF8StringEncoding) 12: object = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves, error: nil) 13: if object 14: object = symbolize_keys(object) if options[:symbolize_keys] 15: object 16: else 17: super(string, options={}) 18: end 19: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.