diff options
Diffstat (limited to 'doc/JSON/Ext/Generator/State.html')
-rw-r--r-- | doc/JSON/Ext/Generator/State.html | 1204 |
1 files changed, 0 insertions, 1204 deletions
diff --git a/doc/JSON/Ext/Generator/State.html b/doc/JSON/Ext/Generator/State.html deleted file mode 100644 index 39b6a88..0000000 --- a/doc/JSON/Ext/Generator/State.html +++ /dev/null @@ -1,1204 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> - - <title>Class: JSON::Ext::Generator::State</title> - - <link rel="stylesheet" href="../../../rdoc.css" type="text/css" media="screen" /> - - <script src="../../../js/jquery.js" type="text/javascript" - charset="utf-8"></script> - <script src="../../../js/thickbox-compressed.js" type="text/javascript" - charset="utf-8"></script> - <script src="../../../js/quicksearch.js" type="text/javascript" - charset="utf-8"></script> - <script src="../../../js/darkfish.js" type="text/javascript" - charset="utf-8"></script> - -</head> -<body class="class"> - - <div id="metadata"> - <div id="file-metadata"> - <div id="file-list-section" class="section"> - <h3 class="section-header">In Files</h3> - <div class="section-body"> - <ul> - - <li><a href="../../../ext/json/ext/generator_c.html?TB_iframe=true&height=550&width=785" - class="thickbox" title="ext/json/ext/generator.c">ext/json/ext/generator.c</a></li> - - </ul> - </div> - </div> - - - </div> - - <div id="class-metadata"> - - <!-- Parent Class --> - - <div id="parent-class-section" class="section"> - <h3 class="section-header">Parent</h3> - - <p class="link"><a href="../../../Object.html">Object</a></p> - - </div> - - - <!-- Namespace Contents --> - - - <!-- Method Quickref --> - - <div id="method-list-section" class="section"> - <h3 class="section-header">Methods</h3> - <ul class="link-list"> - - <li><a href="#M000103">::from_state</a></li> - - <li><a href="#M000104">::new</a></li> - - <li><a href="#M000119">#allow_nan?</a></li> - - <li><a href="#M000114">#array_nl</a></li> - - <li><a href="#M000115">#array_nl=</a></li> - - <li><a href="#M000120">#ascii_only?</a></li> - - <li><a href="#M000121">#configure</a></li> - - <li><a href="#M000123">#generate</a></li> - - <li><a href="#M000105">#indent</a></li> - - <li><a href="#M000106">#indent=</a></li> - - <li><a href="#M000116">#max_nesting</a></li> - - <li><a href="#M000118">#max_nesting=</a></li> - - <li><a href="#M000111">#object_nl</a></li> - - <li><a href="#M000113">#object_nl=</a></li> - - <li><a href="#M000124">#partial_generate</a></li> - - <li><a href="#M000107">#space</a></li> - - <li><a href="#M000108">#space=</a></li> - - <li><a href="#M000109">#space_before</a></li> - - <li><a href="#M000110">#space_before=</a></li> - - <li><a href="#M000122">#to_h</a></li> - - </ul> - </div> - - - <!-- Included Modules --> - - </div> - - <div id="project-metadata"> - - - <div id="fileindex-section" class="section project-section"> - <h3 class="section-header">Files</h3> - <ul> - - <li class="file"><a href="../../../README.html">README</a></li> - - </ul> - </div> - - - <div id="classindex-section" class="section project-section"> - <h3 class="section-header">Class Index - <span class="search-toggle"><img src="../../../images/find.png" - height="16" width="16" alt="[+]" - title="show/hide quicksearch" /></span></h3> - <form action="#" method="get" accept-charset="utf-8" class="initially-hidden"> - <fieldset> - <legend>Quicksearch</legend> - <input type="text" name="quicksearch" value="" - class="quicksearch-field" /> - </fieldset> - </form> - - <ul class="link-list"> - - <li><a href="../../../JSON.html">JSON</a></li> - - <li><a href="../../../JSON/Editor.html">JSON::Editor</a></li> - - <li><a href="../../../JSON/Editor/EditMenu.html">JSON::Editor::EditMenu</a></li> - - <li><a href="../../../JSON/Editor/FileMenu.html">JSON::Editor::FileMenu</a></li> - - <li><a href="../../../JSON/Editor/Gtk.html">JSON::Editor::Gtk</a></li> - - <li><a href="../../../JSON/Editor/Gtk/TreeIter.html">JSON::Editor::Gtk::TreeIter</a></li> - - <li><a href="../../../JSON/Editor/JSONTreeView.html">JSON::Editor::JSONTreeView</a></li> - - <li><a href="../../../JSON/Editor/MainWindow.html">JSON::Editor::MainWindow</a></li> - - <li><a href="../../../JSON/Editor/MenuExtension.html">JSON::Editor::MenuExtension</a></li> - - <li><a href="../../../JSON/Editor/OptionsMenu.html">JSON::Editor::OptionsMenu</a></li> - - <li><a href="../../../JSON/Editor/PopUpMenu.html">JSON::Editor::PopUpMenu</a></li> - - <li><a href="../../../JSON/Ext.html">JSON::Ext</a></li> - - <li><a href="../../../JSON/Ext/Generator.html">JSON::Ext::Generator</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods.html">JSON::Ext::Generator::GeneratorMethods</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/Array.html">JSON::Ext::Generator::GeneratorMethods::Array</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/FalseClass.html">JSON::Ext::Generator::GeneratorMethods::FalseClass</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/Float.html">JSON::Ext::Generator::GeneratorMethods::Float</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/Hash.html">JSON::Ext::Generator::GeneratorMethods::Hash</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/Integer.html">JSON::Ext::Generator::GeneratorMethods::Integer</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/NilClass.html">JSON::Ext::Generator::GeneratorMethods::NilClass</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/Object.html">JSON::Ext::Generator::GeneratorMethods::Object</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/String.html">JSON::Ext::Generator::GeneratorMethods::String</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/String/Extend.html">JSON::Ext::Generator::GeneratorMethods::String::Extend</a></li> - - <li><a href="../../../JSON/Ext/Generator/GeneratorMethods/TrueClass.html">JSON::Ext::Generator::GeneratorMethods::TrueClass</a></li> - - <li><a href="../../../JSON/Ext/Generator/State.html">JSON::Ext::Generator::State</a></li> - - <li><a href="../../../JSON/Ext/Parser.html">JSON::Ext::Parser</a></li> - - <li><a href="../../../JSON/GeneratorError.html">JSON::GeneratorError</a></li> - - <li><a href="../../../JSON/JSONError.html">JSON::JSONError</a></li> - - <li><a href="../../../JSON/MissingUnicodeSupport.html">JSON::MissingUnicodeSupport</a></li> - - <li><a href="../../../JSON/NestingError.html">JSON::NestingError</a></li> - - <li><a href="../../../JSON/ParserError.html">JSON::ParserError</a></li> - - <li><a href="../../../JSON/Pure.html">JSON::Pure</a></li> - - <li><a href="../../../JSON/Pure/Generator.html">JSON::Pure::Generator</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods.html">JSON::Pure::Generator::GeneratorMethods</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/Array.html">JSON::Pure::Generator::GeneratorMethods::Array</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/FalseClass.html">JSON::Pure::Generator::GeneratorMethods::FalseClass</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/Float.html">JSON::Pure::Generator::GeneratorMethods::Float</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/Hash.html">JSON::Pure::Generator::GeneratorMethods::Hash</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/Integer.html">JSON::Pure::Generator::GeneratorMethods::Integer</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/NilClass.html">JSON::Pure::Generator::GeneratorMethods::NilClass</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/Object.html">JSON::Pure::Generator::GeneratorMethods::Object</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/String.html">JSON::Pure::Generator::GeneratorMethods::String</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/String/Extend.html">JSON::Pure::Generator::GeneratorMethods::String::Extend</a></li> - - <li><a href="../../../JSON/Pure/Generator/GeneratorMethods/TrueClass.html">JSON::Pure::Generator::GeneratorMethods::TrueClass</a></li> - - <li><a href="../../../JSON/Pure/Generator/State.html">JSON::Pure::Generator::State</a></li> - - <li><a href="../../../JSON/Pure/Parser.html">JSON::Pure::Parser</a></li> - - <li><a href="../../../Class.html">Class</a></li> - - <li><a href="../../../Date.html">Date</a></li> - - <li><a href="../../../DateTime.html">DateTime</a></li> - - <li><a href="../../../Enumerable.html">Enumerable</a></li> - - <li><a href="../../../Exception.html">Exception</a></li> - - <li><a href="../../../Kernel.html">Kernel</a></li> - - <li><a href="../../../Object.html">Object</a></li> - - <li><a href="../../../Range.html">Range</a></li> - - <li><a href="../../../Regexp.html">Regexp</a></li> - - <li><a href="../../../Struct.html">Struct</a></li> - - <li><a href="../../../Symbol.html">Symbol</a></li> - - <li><a href="../../../Time.html">Time</a></li> - - </ul> - <div id="no-class-search-results" style="display: none;">No matching classes.</div> - </div> - - - </div> - </div> - - <div id="documentation"> - <h1 class="class">JSON::Ext::Generator::State</h1> - - <div id="description"> - - </div> - - <!-- Constants --> - - - <!-- Attributes --> - - - <!-- Methods --> - - <div id="public-class-method-details" class="method-section section"> - <h3 class="section-header">Public Class Methods</h3> - - - <div id="from-state-method" class="method-detail "> - <a name="M000103"></a> - - <div class="method-heading"> - - <span class="method-callseq">from_state(opts)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Creates a <a href="State.html">State</a> object from <em>opts</em>, which -ought to be Hash to create a new <a href="State.html">State</a> instance -configured by <em>opts</em>, something else to create an unconfigured -instance. If <em>opts</em> is a <a href="State.html">State</a> object, it -is just returned. -</p> - - - - <div class="method-source-code" - id="from-state-source"> -<pre> -static VALUE cState_from_state_s(VALUE self, VALUE opts) -{ - if (rb_obj_is_kind_of(opts, self)) { - return opts; - } else if (rb_obj_is_kind_of(opts, rb_cHash)) { - return rb_funcall(self, i_new, 1, opts); - } else { - return rb_funcall(self, i_new, 0); - } -}</pre> - </div> - - </div> - - - </div> - - - <div id="new-method" class="method-detail "> - <a name="M000104"></a> - - <div class="method-heading"> - - <span class="method-callseq">new(opts = {})</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Instantiates a new <a href="State.html">State</a> object, configured by -<em>opts</em>. -</p> -<p> -<em>opts</em> can have the following keys: -</p> -<ul> -<li><b>indent</b>: a string used to indent levels (default: ’’), - -</li> -<li><b>space</b>: a string that is put after, a : or , delimiter (default: -’’), - -</li> -<li><b><a href="State.html#M000109">space_before</a></b>: a string that is put -before a : pair delimiter (default: ’’), - -</li> -<li><b><a href="State.html#M000111">object_nl</a></b>: a string that is put at -the end of a <a href="../../../JSON.html">JSON</a> object (default: -’’), - -</li> -<li><b><a href="State.html#M000114">array_nl</a></b>: a string that is put at -the end of a <a href="../../../JSON.html">JSON</a> array (default: -’’), - -</li> -<li><b>allow_nan</b>: true if NaN, Infinity, and -Infinity should be generated, -otherwise an exception is thrown, if these values are encountered. This -options defaults to false. - -</li> -</ul> - - - - <div class="method-source-code" - id="new-source"> -<pre> -static VALUE cState_initialize(int argc, VALUE *argv, VALUE self) -{ - VALUE opts; - GET_STATE(self); - MEMZERO(state, JSON_Generator_State, 1); - state->max_nesting = 19; - rb_scan_args(argc, argv, "01", &opts); - if (!NIL_P(opts)) cState_configure(self, opts); - return self; -}</pre> - </div> - - </div> - - - </div> - - - </div> - - <div id="public-instance-method-details" class="method-section section"> - <h3 class="section-header">Public Instance Methods</h3> - - - <div id="allow-nan--method" class="method-detail "> - <a name="M000119"></a> - - <div class="method-heading"> - - <span class="method-callseq">allow_nan?</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Returns true, if NaN, Infinity, and -Infinity should be generated, -otherwise returns false. -</p> - - - - <div class="method-source-code" - id="allow-nan--source"> -<pre> -static VALUE cState_allow_nan_p(VALUE self) -{ - GET_STATE(self); - return state->allow_nan ? Qtrue : Qfalse; -}</pre> - </div> - - </div> - - - </div> - - - <div id="array-nl-method" class="method-detail "> - <a name="M000114"></a> - - <div class="method-heading"> - - <span class="method-callseq">array_nl()</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is put at the end of a line that holds a <a -href="../../../JSON.html">JSON</a> array. -</p> - - - - <div class="method-source-code" - id="array-nl-source"> -<pre> -static VALUE cState_array_nl(VALUE self) -{ - GET_STATE(self); - return state->array_nl ? rb_str_new2(state->array_nl) : rb_str_new2(""); -}</pre> - </div> - - </div> - - - </div> - - - <div id="array-nl--method" class="method-detail "> - <a name="M000115"></a> - - <div class="method-heading"> - - <span class="method-callseq">array_nl=(array_nl)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is put at the end of a line that holds a <a -href="../../../JSON.html">JSON</a> array. -</p> - - - - <div class="method-source-code" - id="array-nl--source"> -<pre> -static VALUE cState_array_nl_set(VALUE self, VALUE array_nl) -{ - GET_STATE(self); - Check_Type(array_nl, T_STRING); - if (RSTRING_LEN(array_nl) == 0) { - if (state->array_nl) { - ruby_xfree(state->array_nl); - state->array_nl = NULL; - } - } else { - if (state->array_nl) ruby_xfree(state->array_nl); - state->array_nl = strdup(RSTRING_PTR(array_nl)); - } - return Qnil; -}</pre> - </div> - - </div> - - - </div> - - - <div id="ascii-only--method" class="method-detail "> - <a name="M000120"></a> - - <div class="method-heading"> - - <span class="method-callseq">ascii_only?</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Returns true, if NaN, Infinity, and -Infinity should be generated, -otherwise returns false. -</p> - - - - <div class="method-source-code" - id="ascii-only--source"> -<pre> -static VALUE cState_ascii_only_p(VALUE self) -{ - GET_STATE(self); - return state->ascii_only ? Qtrue : Qfalse; -}</pre> - </div> - - </div> - - - </div> - - - <div id="configure-method" class="method-detail "> - <a name="M000121"></a> - - <div class="method-heading"> - - <span class="method-callseq">configure(opts)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Configure this <a href="State.html">State</a> instance with the Hash -<em>opts</em>, and return itself. -</p> - - - - <div class="method-source-code" - id="configure-source"> -<pre> -static VALUE cState_configure(VALUE self, VALUE opts) -{ - VALUE tmp; - GET_STATE(self); - tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); - if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h"); - if (NIL_P(tmp)) { - rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash"); - } - opts = tmp; - tmp = rb_hash_aref(opts, ID2SYM(i_indent)); - if (RTEST(tmp)) { - Check_Type(tmp, T_STRING); - state->indent = strdup(RSTRING_PTR(tmp)); - state->indent_len = strlen(state->indent); - } - tmp = rb_hash_aref(opts, ID2SYM(i_space)); - if (RTEST(tmp)) { - Check_Type(tmp, T_STRING); - state->space = strdup(RSTRING_PTR(tmp)); - state->space_len = strlen(state->space); - } - tmp = rb_hash_aref(opts, ID2SYM(i_space_before)); - if (RTEST(tmp)) { - Check_Type(tmp, T_STRING); - state->space_before = strdup(RSTRING_PTR(tmp)); - state->space_before_len = strlen(state->space_before); - } - tmp = rb_hash_aref(opts, ID2SYM(i_array_nl)); - if (RTEST(tmp)) { - Check_Type(tmp, T_STRING); - state->array_nl = strdup(RSTRING_PTR(tmp)); - state->array_nl_len = strlen(state->array_nl); - } - tmp = rb_hash_aref(opts, ID2SYM(i_object_nl)); - if (RTEST(tmp)) { - Check_Type(tmp, T_STRING); - state->object_nl = strdup(RSTRING_PTR(tmp)); - state->object_nl_len = strlen(state->object_nl); - } - tmp = ID2SYM(i_max_nesting); - state->max_nesting = 19; - if (st_lookup(RHASH_TBL(opts), tmp, 0)) { - VALUE max_nesting = rb_hash_aref(opts, tmp); - if (RTEST(max_nesting)) { - Check_Type(max_nesting, T_FIXNUM); - state->max_nesting = FIX2LONG(max_nesting); - } else { - state->max_nesting = 0; - } - } - tmp = rb_hash_aref(opts, ID2SYM(i_allow_nan)); - state->allow_nan = RTEST(tmp); - tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only)); - state->ascii_only = RTEST(tmp); - return self; -}</pre> - </div> - - </div> - - - </div> - - - <div id="generate-method" class="method-detail "> - <a name="M000123"></a> - - <div class="method-heading"> - - <span class="method-callseq">generate(obj)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Generates a valid <a href="../../../JSON.html">JSON</a> document from -object <tt>obj</tt> and returns the result. If no valid <a -href="../../../JSON.html">JSON</a> document can be created this method -raises a <a href="../../GeneratorError.html">GeneratorError</a> exception. -</p> - - - - <div class="method-source-code" - id="generate-source"> -<pre> -static VALUE cState_generate(VALUE self, VALUE obj) -{ - VALUE result = cState_partial_generate(self, obj, Qnil); - VALUE re, args[2]; - args[0] = rb_str_new2("\\A\\s*(?:\\[.*\\]|\\{.*\\})\\s*\\Z"); - args[1] = CRegexp_MULTILINE; - re = rb_class_new_instance(2, args, rb_cRegexp); - if (NIL_P(rb_reg_match(re, result))) { - rb_raise(eGeneratorError, "only generation of JSON objects or arrays allowed"); - } - return result; -}</pre> - </div> - - </div> - - - </div> - - - <div id="indent-method" class="method-detail "> - <a name="M000105"></a> - - <div class="method-heading"> - - <span class="method-callseq">indent()</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is used to indent levels in the <a -href="../../../JSON.html">JSON</a> text. -</p> - - - - <div class="method-source-code" - id="indent-source"> -<pre> -static VALUE cState_indent(VALUE self) -{ - GET_STATE(self); - return state->indent ? rb_str_new2(state->indent) : rb_str_new2(""); -}</pre> - </div> - - </div> - - - </div> - - - <div id="indent--method" class="method-detail "> - <a name="M000106"></a> - - <div class="method-heading"> - - <span class="method-callseq">indent=(indent)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is used to indent levels in the <a -href="../../../JSON.html">JSON</a> text. -</p> - - - - <div class="method-source-code" - id="indent--source"> -<pre> -static VALUE cState_indent_set(VALUE self, VALUE indent) -{ - GET_STATE(self); - Check_Type(indent, T_STRING); - if (RSTRING_LEN(indent) == 0) { - if (state->indent) { - ruby_xfree(state->indent); - state->indent = NULL; - } - } else { - if (state->indent) ruby_xfree(state->indent); - state->indent = strdup(RSTRING_PTR(indent)); - } - return Qnil; -}</pre> - </div> - - </div> - - - </div> - - - <div id="max-nesting-method" class="method-detail "> - <a name="M000116"></a> - - <div class="method-heading"> - - <span class="method-callseq">max_nesting</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This integer returns the maximum level of data structure nesting in the -generated <a href="../../../JSON.html">JSON</a>, <a -href="State.html#M000116">max_nesting</a> = 0 if no maximum is checked. -</p> - - - - <div class="method-source-code" - id="max-nesting-source"> -<pre> -static VALUE cState_max_nesting(VALUE self) -{ - GET_STATE(self); - return LONG2FIX(state->max_nesting); -}</pre> - </div> - - </div> - - - </div> - - - <div id="max-nesting--method" class="method-detail "> - <a name="M000118"></a> - - <div class="method-heading"> - - <span class="method-callseq">max_nesting=(depth)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This sets the maximum level of data structure nesting in the generated <a -href="../../../JSON.html">JSON</a> to the integer depth, <a -href="State.html#M000116">max_nesting</a> = 0 if no maximum should be -checked. -</p> - - - - <div class="method-source-code" - id="max-nesting--source"> -<pre> -static VALUE cState_max_nesting_set(VALUE self, VALUE depth) -{ - GET_STATE(self); - Check_Type(depth, T_FIXNUM); - return state->max_nesting = FIX2LONG(depth); -}</pre> - </div> - - </div> - - - </div> - - - <div id="object-nl-method" class="method-detail "> - <a name="M000111"></a> - - <div class="method-heading"> - - <span class="method-callseq">object_nl()</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is put at the end of a line that holds a <a -href="../../../JSON.html">JSON</a> object (or Hash). -</p> - - - - <div class="method-source-code" - id="object-nl-source"> -<pre> -static VALUE cState_object_nl(VALUE self) -{ - GET_STATE(self); - return state->object_nl ? rb_str_new2(state->object_nl) : rb_str_new2(""); -}</pre> - </div> - - </div> - - - </div> - - - <div id="object-nl--method" class="method-detail "> - <a name="M000113"></a> - - <div class="method-heading"> - - <span class="method-callseq">object_nl=(object_nl)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is put at the end of a line that holds a <a -href="../../../JSON.html">JSON</a> object (or Hash). -</p> - - - - <div class="method-source-code" - id="object-nl--source"> -<pre> -static VALUE cState_object_nl_set(VALUE self, VALUE object_nl) -{ - GET_STATE(self); - Check_Type(object_nl, T_STRING); - if (RSTRING_LEN(object_nl) == 0) { - if (state->object_nl) { - ruby_xfree(state->object_nl); - state->object_nl = NULL; - } - } else { - if (state->object_nl) ruby_xfree(state->object_nl); - state->object_nl = strdup(RSTRING_PTR(object_nl)); - } - return Qnil; -}</pre> - </div> - - </div> - - - </div> - - - <div id="partial-generate-method" class="method-detail "> - <a name="M000124"></a> - - <div class="method-heading"> - - <span class="method-callseq">partial_generate(obj)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Generates a part of a <a href="../../../JSON.html">JSON</a> document from -object <tt>obj</tt> and returns the result. -</p> - - - - <div class="method-source-code" - id="partial-generate-source"> -<pre> -static VALUE cState_partial_generate(VALUE self, VALUE obj, VALUE depth) -{ - VALUE result; - FBuffer *buffer = fbuffer_alloc(); - GET_STATE(self); - - if (state->object_delim) { - fbuffer_clear(state->object_delim); - } else { - state->object_delim = fbuffer_alloc_with_length(16); - } - fbuffer_append_char(state->object_delim, ','); - if (state->object_delim2) { - fbuffer_clear(state->object_delim2); - } else { - state->object_delim2 = fbuffer_alloc_with_length(16); - } - fbuffer_append_char(state->object_delim2, ':'); - if (state->space) fbuffer_append(state->object_delim2, state->space, state->space_len); - - if (state->array_delim) { - fbuffer_clear(state->array_delim); - } else { - state->array_delim = fbuffer_alloc_with_length(16); - } - fbuffer_append_char(state->array_delim, ','); - if (state->array_nl) fbuffer_append(state->array_delim, state->array_nl, state->array_nl_len); - - generate_json(buffer, self, state, obj, NIL_P(depth) ? 0 : FIX2INT(depth)); - result = fbuffer2rstring(buffer); - fbuffer_free_only_buffer(buffer); - FORCE_UTF8(result); - return result; -}</pre> - </div> - - </div> - - - </div> - - - <div id="space-method" class="method-detail "> - <a name="M000107"></a> - - <div class="method-heading"> - - <span class="method-callseq">space()</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is used to insert a space between the tokens in a <a -href="../../../JSON.html">JSON</a> string. -</p> - - - - <div class="method-source-code" - id="space-source"> -<pre> -static VALUE cState_space(VALUE self) -{ - GET_STATE(self); - return state->space ? rb_str_new2(state->space) : rb_str_new2(""); -}</pre> - </div> - - </div> - - - </div> - - - <div id="space--method" class="method-detail "> - <a name="M000108"></a> - - <div class="method-heading"> - - <span class="method-callseq">space=(space)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is used to insert a space between the tokens in a <a -href="../../../JSON.html">JSON</a> string. -</p> - - - - <div class="method-source-code" - id="space--source"> -<pre> -static VALUE cState_space_set(VALUE self, VALUE space) -{ - GET_STATE(self); - Check_Type(space, T_STRING); - if (RSTRING_LEN(space) == 0) { - if (state->space) { - ruby_xfree(state->space); - state->space = NULL; - } - } else { - if (state->space) ruby_xfree(state->space); - state->space = strdup(RSTRING_PTR(space)); - } - return Qnil; -}</pre> - </div> - - </div> - - - </div> - - - <div id="space-before-method" class="method-detail "> - <a name="M000109"></a> - - <div class="method-heading"> - - <span class="method-callseq">space_before()</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is used to insert a space before the ’:’ in <a -href="../../../JSON.html">JSON</a> objects. -</p> - - - - <div class="method-source-code" - id="space-before-source"> -<pre> -static VALUE cState_space_before(VALUE self) -{ - GET_STATE(self); - return state->space_before ? rb_str_new2(state->space_before) : rb_str_new2(""); -}</pre> - </div> - - </div> - - - </div> - - - <div id="space-before--method" class="method-detail "> - <a name="M000110"></a> - - <div class="method-heading"> - - <span class="method-callseq">space_before=(space_before)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -This string is used to insert a space before the ’:’ in <a -href="../../../JSON.html">JSON</a> objects. -</p> - - - - <div class="method-source-code" - id="space-before--source"> -<pre> -static VALUE cState_space_before_set(VALUE self, VALUE space_before) -{ - GET_STATE(self); - Check_Type(space_before, T_STRING); - if (RSTRING_LEN(space_before) == 0) { - if (state->space_before) { - ruby_xfree(state->space_before); - state->space_before = NULL; - } - } else { - if (state->space_before) ruby_xfree(state->space_before); - state->space_before = strdup(RSTRING_PTR(space_before)); - } - return Qnil; -}</pre> - </div> - - </div> - - - </div> - - - <div id="to-h-method" class="method-detail "> - <a name="M000122"></a> - - <div class="method-heading"> - - <span class="method-callseq">to_h</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - <p> -Returns the configuration instance variables as a hash, that can be passed -to the configure method. -</p> - - - - <div class="method-source-code" - id="to-h-source"> -<pre> -static VALUE cState_to_h(VALUE self) -{ - VALUE result = rb_hash_new(); - GET_STATE(self); - rb_hash_aset(result, ID2SYM(i_indent), rb_str_new2(state->indent)); - rb_hash_aset(result, ID2SYM(i_space), rb_str_new2(state->space)); - rb_hash_aset(result, ID2SYM(i_space_before), rb_str_new2(state->space_before)); - rb_hash_aset(result, ID2SYM(i_object_nl), rb_str_new2(state->object_nl)); - rb_hash_aset(result, ID2SYM(i_array_nl), rb_str_new2(state->array_nl)); - rb_hash_aset(result, ID2SYM(i_allow_nan), state->allow_nan ? Qtrue : Qfalse); - rb_hash_aset(result, ID2SYM(i_ascii_only), state->ascii_only ? Qtrue : Qfalse); - rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting)); - return result; -}</pre> - </div> - - </div> - - - </div> - - - </div> - - - </div> - - - <div id="rdoc-debugging-section-dump" class="debugging-section"> - - <p>Disabled; run with --debug to generate this.</p> - - </div> - - <div id="validator-badges"> - <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> - <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish - Rdoc Generator</a> 1.1.6</small>.</p> - </div> - -</body> -</html> - |