Server IP : 66.29.132.122 / Your IP : 3.137.184.3 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/multi_json-1.15.0/lib/multi_json/adapters/ |
Upload File : |
# This adapter is here for legacy reasons. We can't really test it, so it's hard # to tell if it's even working properly. If you're still using it, please # consider migrating to any other adapter out there. framework 'Foundation' require 'multi_json/adapters/ok_json' module MultiJson module Adapters class Nsjsonserialization < MultiJson::Adapters::OkJson ParseError = ::MultiJson::OkJson::Error def load(string, options = {}) data = string.dataUsingEncoding(NSUTF8StringEncoding) object = NSJSONSerialization.JSONObjectWithData(data, :options => NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves, :error => nil) if object object = symbolize_keys(object) if options[:symbolize_keys] object else super(string, options) end end def dump(object, options = {}) pretty = options[:pretty] ? NSJSONWritingPrettyPrinted : 0 object = object.as_json if object.respond_to?(:as_json) if NSJSONSerialization.isValidJSONObject(object) data = NSJSONSerialization.dataWithJSONObject(object, :options => pretty, :error => nil) NSMutableString.alloc.initWithData(data, :encoding => NSUTF8StringEncoding) else super(object, options) end end end end end