Module | JSON::Pure::Generator::GeneratorMethods::String |
In: |
lib/json/pure/generator.rb
|
Extends modul with the String::Extend module.
# File lib/json/pure/generator.rb, line 390 390: def self.included(modul) 391: modul.extend Extend 392: end
This method creates a JSON text from the result of a call to to_json_raw_object of this String.
# File lib/json/pure/generator.rb, line 407 407: def to_json_raw(*args) 408: to_json_raw_object.to_json(*args) 409: end
This method creates a raw object hash, that can be nested into other data structures and will be unparsed as a raw string. This method should be used, if you want to convert raw strings to JSON instead of UTF-8 strings, e. g. binary data.
# File lib/json/pure/generator.rb, line 398 398: def to_json_raw_object 399: { 400: JSON.create_id => self.class.name, 401: 'raw' => self.unpack('C*'), 402: } 403: end