diff options
Diffstat (limited to 'doc/JSON/Pure/Generator/GeneratorMethods/Hash.html')
-rw-r--r-- | doc/JSON/Pure/Generator/GeneratorMethods/Hash.html | 403 |
1 files changed, 403 insertions, 0 deletions
diff --git a/doc/JSON/Pure/Generator/GeneratorMethods/Hash.html b/doc/JSON/Pure/Generator/GeneratorMethods/Hash.html new file mode 100644 index 0000000..7360f1d --- /dev/null +++ b/doc/JSON/Pure/Generator/GeneratorMethods/Hash.html @@ -0,0 +1,403 @@ +<?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>Module: JSON::Pure::Generator::GeneratorMethods::Hash</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="module"> + + <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="../../../../lib/json/pure/generator_rb.html?TB_iframe=true&height=550&width=785" + class="thickbox" title="lib/json/pure/generator.rb">lib/json/pure/generator.rb</a></li> + + </ul> + </div> + </div> + + + </div> + + <div id="class-metadata"> + + <!-- Parent Class --> + + + <!-- Namespace Contents --> + + + <!-- Method Quickref --> + + <div id="method-list-section" class="section"> + <h3 class="section-header">Methods</h3> + <ul class="link-list"> + + <li><a href="#M000051">#json_shift</a></li> + + <li><a href="#M000052">#json_transform</a></li> + + <li><a href="#M000050">#to_json</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="module">JSON::Pure::Generator::GeneratorMethods::Hash</h1> + + <div id="description"> + + </div> + + <!-- Constants --> + + + <!-- Attributes --> + + + <!-- Methods --> + + <div id="public-instance-method-details" class="method-section section"> + <h3 class="section-header">Public Instance Methods</h3> + + + <div id="to-json-method" class="method-detail "> + <a name="M000050"></a> + + <div class="method-heading"> + + <span class="method-name">to_json</span><span + class="method-args">(state = nil, depth = 0, *)</span> + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-description"> + + <p> +Returns a <a href="../../../../JSON.html">JSON</a> string containing a <a +href="../../../../JSON.html">JSON</a> object, that is unparsed from this <a +href="Hash.html">Hash</a> instance. <em>state</em> is a JSON::State object, +that can also be used to configure the produced <a +href="../../../../JSON.html">JSON</a> string output further. <em>depth</em> +is used to find out nesting depth, to indent accordingly. +</p> + + + + <div class="method-source-code" + id="to-json-source"> +<pre> +<span class="ruby-comment cmt"># File lib/json/pure/generator.rb, line 245</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">state</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">depth</span> = <span class="ruby-value">0</span>, <span class="ruby-operator">*</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">state</span> + <span class="ruby-identifier">state</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">state</span>.<span class="ruby-identifier">from_state</span>(<span class="ruby-identifier">state</span>) + <span class="ruby-identifier">state</span>.<span class="ruby-identifier">check_max_nesting</span>(<span class="ruby-identifier">depth</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">json_transform</span>(<span class="ruby-identifier">state</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-keyword kw">end</span></pre> + </div> + + </div> + + + </div> + + + </div> + + <div id="private-instance-method-details" class="method-section section"> + <h3 class="section-header">Private Instance Methods</h3> + + + <div id="json-shift-method" class="method-detail "> + <a name="M000051"></a> + + <div class="method-heading"> + + <span class="method-name">json_shift</span><span + class="method-args">(state, depth)</span> + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-description"> + + <p class="missing-docs">(Not documented)</p> + + + + <div class="method-source-code" + id="json-shift-source"> +<pre> +<span class="ruby-comment cmt"># File lib/json/pure/generator.rb, line 255</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json_shift</span>(<span class="ruby-identifier">state</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-identifier">state</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">object_nl</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span> + <span class="ruby-identifier">state</span>.<span class="ruby-identifier">indent</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">depth</span> + <span class="ruby-keyword kw">end</span></pre> + </div> + + </div> + + + </div> + + + <div id="json-transform-method" class="method-detail "> + <a name="M000052"></a> + + <div class="method-heading"> + + <span class="method-name">json_transform</span><span + class="method-args">(state, depth)</span> + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-description"> + + <p class="missing-docs">(Not documented)</p> + + + + <div class="method-source-code" + id="json-transform-source"> +<pre> +<span class="ruby-comment cmt"># File lib/json/pure/generator.rb, line 260</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">json_transform</span>(<span class="ruby-identifier">state</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-identifier">delim</span> = <span class="ruby-value str">','</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">state</span> + <span class="ruby-identifier">delim</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">object_nl</span> + <span class="ruby-identifier">result</span> = <span class="ruby-value str">'{'</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">object_nl</span> + <span class="ruby-identifier">depth</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> + <span class="ruby-identifier">first</span> = <span class="ruby-keyword kw">true</span> + <span class="ruby-identifier">indent</span> = <span class="ruby-identifier">state</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">state</span>.<span class="ruby-identifier">object_nl</span>.<span class="ruby-identifier">empty?</span> + <span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">delim</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">first</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">indent</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">depth</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">indent</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">state</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">space_before</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">':'</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">space</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">state</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-identifier">first</span> = <span class="ruby-keyword kw">false</span> + } + <span class="ruby-identifier">depth</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">object_nl</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">state</span>.<span class="ruby-identifier">indent</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">depth</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">indent</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'}'</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">result</span> = <span class="ruby-value str">'{'</span> + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_json</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">':'</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_json</span> + }.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">delim</span>) + <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">'}'</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">result</span> + <span class="ruby-keyword kw">end</span></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> + |