Module JSON::Pure::Generator::GeneratorMethods::String
In: lib/json/pure/generator.rb
ParserError NestingError GeneratorError CircularDatastructure StandardError JSONError MissingUnicodeSupport Gtk StringScanner Parser State lib/json/common.rb Ext Editor lib/json/pure/parser.rb lib/json/pure/generator.rb Integer FalseClass Array Hash Float NilClass Object TrueClass Extend String GeneratorMethods Generator Pure JSON dot/m_9_1.png

Methods

Classes and Modules

Module JSON::Pure::Generator::GeneratorMethods::String::Extend

Public Class methods

Extends modul with the String::Extend module.

[Source]

     # File lib/json/pure/generator.rb, line 355
355:           def self.included(modul)
356:             modul.extend Extend
357:           end

Public Instance methods

This string should be encoded with UTF-8 A call to this method returns a JSON string encoded with UTF16 big endian characters as \u????.

[Source]

     # File lib/json/pure/generator.rb, line 340
340:           def to_json(*)
341:             '"' << JSON.utf8_to_json(self) << '"'
342:           end

This method creates a JSON text from the result of a call to to_json_raw_object of this String.

[Source]

     # File lib/json/pure/generator.rb, line 372
372:           def to_json_raw(*args)
373:             to_json_raw_object.to_json(*args)
374:           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.

[Source]

     # File lib/json/pure/generator.rb, line 363
363:           def to_json_raw_object
364:             {
365:               JSON.create_id  => self.class.name,
366:               'raw'           => self.unpack('C*'),
367:             }
368:           end

[Validate]