summaryrefslogtreecommitdiff
path: root/doc/classes/OpenStruct.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/OpenStruct.html')
-rw-r--r--doc/classes/OpenStruct.html238
1 files changed, 238 insertions, 0 deletions
diff --git a/doc/classes/OpenStruct.html b/doc/classes/OpenStruct.html
new file mode 100644
index 0000000..eaf757a
--- /dev/null
+++ b/doc/classes/OpenStruct.html
@@ -0,0 +1,238 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>OpenStruct</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
+<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
+<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
+<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
+<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
+<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
+<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
+
+</head>
+
+<body>
+ <div class="banner">
+
+ <h1>
+ <span class="type">Class</span>
+ OpenStruct
+
+ <span class="parent">&lt;
+
+ Object
+
+ </span>
+
+ </h1>
+ <ul class="files">
+
+ <li><a href="../files/lib/json/add/ostruct_rb.html">lib/json/add/ostruct.rb</a></li>
+
+ </ul>
+ </div>
+ <div id="bodyContent">
+ <div id="content">
+
+ <div class="description">
+
+<p><a href="OpenStruct.html">OpenStruct</a> serialization/deserialization</p>
+
+ </div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <!-- Method ref -->
+ <div class="sectiontitle">Methods</div>
+ <dl class="methods">
+
+ <dt>A</dt>
+ <dd>
+ <ul>
+
+
+ <li>
+ <a href="#method-i-as_json">as_json</a>
+ </li>
+
+ </ul>
+ </dd>
+
+ <dt>J</dt>
+ <dd>
+ <ul>
+
+
+ <li>
+ <a href="#method-c-json_create">json_create</a>
+ </li>
+
+ </ul>
+ </dd>
+
+ <dt>T</dt>
+ <dd>
+ <ul>
+
+
+ <li>
+ <a href="#method-i-to_json">to_json</a>
+ </li>
+
+ </ul>
+ </dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <!-- Methods -->
+
+ <div class="sectiontitle">Class Public methods</div>
+
+ <div class="method">
+ <div class="title method-title" id="method-c-json_create">
+
+ <a name="method-c-json_create"></a><b>json_create</b>(object)
+
+ </div>
+
+
+ <div class="description">
+ <p>Deserializes <a href="JSON.html">JSON</a> string by constructing new <a
+href="Struct.html">Struct</a> object with values <code>v</code> serialized
+by <code>to_json</code>.</p>
+ </div>
+
+
+
+
+
+
+ <div class="sourcecode">
+
+ <p class="source-link">
+ Source:
+ <a href="javascript:toggleSource('method-c-json_create_source')" id="l_method-c-json_create_source">show</a>
+
+ </p>
+ <div id="method-c-json_create_source" class="dyn-source">
+ <pre><span class="ruby-comment"># File lib/json/add/ostruct.rb, line 11</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">json_create</span>(<span class="ruby-identifier">object</span>)
+ <span class="ruby-identifier">new</span>(<span class="ruby-identifier">object</span>[<span class="ruby-string">'t'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">object</span>[<span class="ruby-value">:t</span>])
+<span class="ruby-keyword">end</span></pre>
+ </div>
+ </div>
+
+ </div>
+
+ <div class="sectiontitle">Instance Public methods</div>
+
+ <div class="method">
+ <div class="title method-title" id="method-i-as_json">
+
+ <a name="method-i-as_json"></a><b>as_json</b>(*)
+
+ </div>
+
+
+ <div class="description">
+ <p>Returns a hash, that will be turned into a <a href="JSON.html">JSON</a>
+object and represent this object.</p>
+ </div>
+
+
+
+
+
+
+ <div class="sourcecode">
+
+ <p class="source-link">
+ Source:
+ <a href="javascript:toggleSource('method-i-as_json_source')" id="l_method-i-as_json_source">show</a>
+
+ </p>
+ <div id="method-i-as_json_source" class="dyn-source">
+ <pre><span class="ruby-comment"># File lib/json/add/ostruct.rb, line 17</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">as_json</span>(*)
+ <span class="ruby-identifier">klass</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">JSONError</span>, <span class="ruby-string">&quot;Only named structs are supported!&quot;</span>
+ {
+ <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">create_id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">klass</span>,
+ <span class="ruby-string">'t'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">table</span>,
+ }
+<span class="ruby-keyword">end</span></pre>
+ </div>
+ </div>
+
+ </div>
+
+ <div class="method">
+ <div class="title method-title" id="method-i-to_json">
+
+ <a name="method-i-to_json"></a><b>to_json</b>(*args)
+
+ </div>
+
+
+ <div class="description">
+ <p>Stores class name (<a href="OpenStruct.html">OpenStruct</a>) with this
+struct’s values <code>v</code> as a <a href="JSON.html">JSON</a> string.</p>
+ </div>
+
+
+
+
+
+
+ <div class="sourcecode">
+
+ <p class="source-link">
+ Source:
+ <a href="javascript:toggleSource('method-i-to_json_source')" id="l_method-i-to_json_source">show</a>
+
+ </p>
+ <div id="method-i-to_json_source" class="dyn-source">
+ <pre><span class="ruby-comment"># File lib/json/add/ostruct.rb, line 28</span>
+<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_json</span>(*<span class="ruby-identifier">args</span>)
+ <span class="ruby-identifier">as_json</span>.<span class="ruby-identifier">to_json</span>(*<span class="ruby-identifier">args</span>)
+<span class="ruby-keyword">end</span></pre>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </body>
+</html> \ No newline at end of file