| Module | JSON::Ext::Generator::GeneratorMethods::String |
| In: |
ext/json/ext/generator/generator.c
|
Extends modul with the String::Extend module.
/*
* call-seq: String.included(modul)
*
* Extends _modul_ with the String::Extend module.
*/
static VALUE mString_included_s(VALUE self, VALUE modul) {
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????.
/*
* call-seq: to_json(*)
*
* 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????.
*/
static VALUE mString_to_json(int argc, VALUE *argv, VALUE self)
{
VALUE result = rb_str_buf_new(RSTRING_LEN(self));
rb_str_buf_cat2(result, "\"");
JSON_convert_UTF8_to_JSON(result, self, strictConversion);
rb_str_buf_cat2(result, "\"");
return result;
}
This method creates a JSON text from the result of a call to to_json_raw_object of this String.
/*
* call-seq: to_json_raw(*args)
*
* This method creates a JSON text from the result of a call to
* to_json_raw_object of this String.
*/
static VALUE mString_to_json_raw(int argc, VALUE *argv, VALUE self) {
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.
/*
* call-seq: to_json_raw_object()
*
* 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.
*/
static VALUE mString_to_json_raw_object(VALUE self) {