doc/Blobject.html in blobject-0.3.7 vs doc/Blobject.html in blobject-0.4.0

- old
+ new

@@ -101,12 +101,11 @@ </dl> <div class="clear"></div> <h2>Overview</h2><div class="docstring"> <div class="discussion"> - -<p>Wraps a hash to provide arbitrarily nested, object-style attribute access</p> + <p>Wraps a hash to provide arbitrarily nested object-style attribute access</p> </div> </div> <div class="tags"> @@ -118,13 +117,12 @@ <dl class="constants"> <dt id="ProhibitedNames-constant" class="">ProhibitedNames = <div class="docstring"> <div class="discussion"> - -<p>filter :to_ary else Blobject#to_ary returns a blobject which is not cool, -especially if you are puts.</p> + <p>filter :to<em>ary else Blobject#to</em>ary returns a +blobject which is not cool, especially if you are puts.</p> </div> </div> <div class="tags"> @@ -133,13 +131,23 @@ </div> </dt> <dd><pre class="code"><span class='lbracket'>[</span><span class='symbol'>:to_ary</span><span class='rbracket'>]</span></pre></dd> <dt id="VERSION-constant" class="">VERSION = - + <div class="docstring"> + <div class="discussion"> + <p>semver gem version</p> + + + </div> +</div> +<div class="tags"> + + +</div> </dt> - <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.3.3</span><span class='tstring_end'>'</span></span></pre></dd> + <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.3.8</span><span class='tstring_end'>'</span></span></pre></dd> </dl> @@ -171,13 +179,11 @@ - <span class="summary_desc"><div class='inline'> -<p>get a Blobject from a json string if the yaml string describes an array, an -array will be returned.</p> + <span class="summary_desc"><div class='inline'><p>get a Blobject from a json string, if the yaml string describes an array, an array will be returned.</p> </div></span> </li> @@ -196,13 +202,11 @@ - <span class="summary_desc"><div class='inline'> -<p>get a Blobject from a yaml string if the yaml string describes an array, an -array will be returned.</p> + <span class="summary_desc"><div class='inline'><p>get a Blobject from a yaml string, if the yaml string describes an array, an array will be returned.</p> </div></span> </li> @@ -230,12 +234,11 @@ - <span class="summary_desc"><div class='inline'> -<p>compares Blobjects to Blobjects or Hashes.</p> + <span class="summary_desc"><div class='inline'><p>compares Blobjects to Blobjects or Hashes for equality.</p> </div></span> </li> @@ -254,12 +257,11 @@ - <span class="summary_desc"><div class='inline'> -<p>hash-like access to the Blobject's attributes.</p> + <span class="summary_desc"><div class='inline'><p>hash-like access to the Blobject&#39;s attributes.</p> </div></span> </li> @@ -278,12 +280,11 @@ - <span class="summary_desc"><div class='inline'> -<p>hash-like attribtue setter.</p> + <span class="summary_desc"><div class='inline'><p>hash-like attribute setter.</p> </div></span> </li> @@ -302,20 +303,42 @@ - <span class="summary_desc"><div class='inline'> -<p>returns a hash which can be serialized as json.</p> + <span class="summary_desc"><div class='inline'><p>for rails: <code>render json: blobject</code>.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> + <a href="#empty%3F-instance_method" title="#empty? (instance method)">- (Boolean) <strong>empty?</strong> </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'><p>indicates whether the blobject contains any data.</p> +</div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + <a href="#freeze-instance_method" title="#freeze (instance method)">- (Object) <strong>freeze</strong> </a> </span> @@ -326,20 +349,42 @@ - <span class="summary_desc"><div class='inline'> -<p>freeze a Blobject to prevent it being modified.</p> + <span class="summary_desc"><div class='inline'><p>freeze a Blobject to prevent it being modified.</p> </div></span> </li> <li class="public "> <span class="summary_signature"> + <a href="#freeze_r-instance_method" title="#freeze_r (instance method)">- (Object) <strong>freeze_r</strong> </a> + + + + </span> + + + + + + + + + + <span class="summary_desc"><div class='inline'><p>recursively freeze the Blobject include nest Blobjects in arrays.</p> +</div></span> + +</li> + + + <li class="public "> + <span class="summary_signature"> + <a href="#hash-instance_method" title="#hash (instance method)">- (Object) <strong>hash</strong> </a> </span> @@ -350,12 +395,11 @@ - <span class="summary_desc"><div class='inline'> -<p>access the internal hash.</p> + <span class="summary_desc"><div class='inline'><p>access the internal hash.</p> </div></span> </li> @@ -376,13 +420,12 @@ - <span class="summary_desc"><div class='inline'> -<p>pass an optional hash of values to preload you can also pass a block, the -new Blobject will be yield.</p> + <span class="summary_desc"><div class='inline'><p>pass an optional hash of values to preload +you can also pass a block, the new Blobject will be yield.</p> </div></span> </li> @@ -401,12 +444,11 @@ - <span class="summary_desc"><div class='inline'> -<p>delegates to the internal Hash.</p> + <span class="summary_desc"><div class='inline'><p>delegates to the internal Hash.</p> </div></span> </li> @@ -425,12 +467,11 @@ - <span class="summary_desc"><div class='inline'> -<p>method_missing is only called the first time an attribute is used.</p> + <span class="summary_desc"><div class='inline'><p>method_missing is only called the first time an attribute is used.</p> </div></span> </li> @@ -471,12 +512,11 @@ - <span class="summary_desc"><div class='inline'> -<p>creates a recursive copy of the internal hash.</p> + <span class="summary_desc"><div class='inline'><p>creates a recursive copy of the internal hash.</p> </div></span> </li> @@ -495,12 +535,11 @@ - <span class="summary_desc"><div class='inline'> -<p>serialize the Blobject as a json string.</p> + <span class="summary_desc"><div class='inline'><p>serialize the Blobject as a json string.</p> </div></span> </li> @@ -519,12 +558,11 @@ - <span class="summary_desc"><div class='inline'> -<p>serialize the Blobject as a yaml string.</p> + <span class="summary_desc"><div class='inline'><p>serialize the Blobject as a yaml string.</p> </div></span> </li> @@ -543,13 +581,12 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>pass an optional hash of values to preload you can also pass a block, the -new Blobject will be yield</p> + <p>pass an optional hash of values to preload +you can also pass a block, the new Blobject will be yield</p> </div> </div> <div class="tags"> @@ -578,12 +615,11 @@ <span class='type'>(<tt><span class='object_link'><a href="" title="Blobject (class)">Blobject</a></span></tt>)</span> &mdash; - <div class='inline'> -<p>the object that the method was called on</p> + <div class='inline'><p>the object that the method was called on</p> </div> </li> </ul> @@ -606,36 +642,26 @@ 23 24 25 26 27 -28 -29 -30 -31 -32 -33</pre> +28</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 14</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_hash'>hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span> - <span class='ivar'>@hash</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span> + <span class='ivar'>@hash</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> - <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> - <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>&lt;=</span> <span class='const'>Symbol</span> - <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_key'>key</span> - <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> - <span class='ivar'>@hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> - <span class='kw'>end</span> + <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> + <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Symbol</span> + <span class='ivar'>@hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>end</span> - <span class='id identifier rubyid___visit_subtree__'>__visit_subtree__</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='op'>|</span> - <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>&lt;=</span> <span class='const'>Hash</span> - <span class='ivar'>@hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Blobject</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_node'>node</span> - <span class='kw'>end</span> + <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='op'>|</span> + <span class='ivar'>@hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:__blobjectify__</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='kw'>yield</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span> <span class='kw'>end</span></pre> </td> @@ -660,13 +686,12 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>method_missing is only called the first time an attribute is used. -successive calls use memoized getters, setters and checkers</p> + <p>method_missing is only called the first time an attribute is used. successive calls use +memoized getters, setters and checkers</p> </div> </div> <div class="tags"> @@ -716,11 +741,12 @@ 94 95 96 97 98 -99</pre> +99 +100</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 59</span> <span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span> <span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_params'>params</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span> @@ -729,17 +755,18 @@ <span class='kw'>case</span> <span class='comment'># assignment in conditionals is usually a bad smell, here it helps minimize regex matching </span> <span class='kw'>when</span> <span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_method'>method</span><span class='lbracket'>[</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\w+$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_params'>params</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>0</span> <span class='comment'># the call is an attribute reader -</span> <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_frozen?'>frozen?</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> - +</span> + <span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span> <span class='kw'>if</span> <span class='id identifier rubyid_frozen?'>frozen?</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='symbol'>:__define_attribute__</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span> <span class='kw'>return</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='id identifier rubyid_method'>method</span> - <span class='id identifier rubyid_parent'>parent</span> <span class='op'>=</span> <span class='kw'>self</span> + <span class='comment'># close the scope for storing call chain +</span> <span class='id identifier rubyid_parent'>parent</span> <span class='op'>=</span> <span class='kw'>self</span> <span class='id identifier rubyid_nested_blobject'>nested_blobject</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_store_in_parent'>store_in_parent</span> <span class='op'>=</span> <span class='id identifier rubyid_lambda'>lambda</span> <span class='kw'>do</span> <span class='id identifier rubyid_parent'>parent</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_nested_blobject'>nested_blobject</span> <span class='id identifier rubyid_nested_blobject'>nested_blobject</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='symbol'>:remove_instance_variable</span><span class='comma'>,</span> <span class='symbol'>:@store_in_parent</span> @@ -785,13 +812,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>get a Blobject from a json string if the yaml string describes an array, an -array will be returned</p> + <p>get a Blobject from a json string, if the yaml string describes an array, an array will be returned</p> </div> </div> <div class="tags"> @@ -801,21 +826,21 @@ <tr> <td> <pre class="lines"> -159 -160 -161 -162</pre> +164 +165 +166 +167</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 159</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 164</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_json'>from_json</span> <span class='id identifier rubyid_json'>json</span> - <span class='id identifier rubyid___from_hash_or_array__'>__from_hash_or_array__</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span><span class='rparen'>)</span> + <span class='id identifier rubyid___blobjectify__'>__blobjectify__</span><span class='lparen'>(</span><span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_json'>json</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> @@ -829,13 +854,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>get a Blobject from a yaml string if the yaml string describes an array, an -array will be returned</p> + <p>get a Blobject from a yaml string, if the yaml string describes an array, an array will be returned</p> </div> </div> <div class="tags"> @@ -845,21 +868,21 @@ <tr> <td> <pre class="lines"> -166 -167 -168 -169</pre> +170 +171 +172 +173</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 166</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 170</span> <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_from_yaml'>from_yaml</span> <span class='id identifier rubyid_yaml'>yaml</span> - <span class='id identifier rubyid___from_hash_or_array__'>__from_hash_or_array__</span><span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_yaml'>yaml</span><span class='rparen'>)</span><span class='rparen'>)</span> + <span class='id identifier rubyid___blobjectify__'>__blobjectify__</span><span class='lparen'>(</span><span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_yaml'>yaml</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> @@ -879,12 +902,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>compares Blobjects to Blobjects or Hashes</p> + <p>compares Blobjects to Blobjects or Hashes for equality</p> </div> </div> <div class="tags"> @@ -894,18 +916,18 @@ <tr> <td> <pre class="lines"> -114 115 116 117 -118</pre> +118 +119</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 114</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 115</span> <span class='kw'>def</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span> <span class='kw'>return</span> <span class='ivar'>@hash</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_hash'>hash</span> <span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>&lt;=</span> <span class='const'>Blobject</span> <span class='kw'>return</span> <span class='ivar'>@hash</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span> <span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>&lt;=</span> <span class='const'>Hash</span> <span class='kw'>super</span> @@ -924,12 +946,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>hash-like access to the Blobject's attributes</p> + <p>hash-like access to the Blobject&#39;s attributes</p> </div> </div> <div class="tags"> @@ -939,17 +960,17 @@ <tr> <td> <pre class="lines"> -121 122 123 -124</pre> +124 +125</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 121</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 122</span> <span class='kw'>def</span> <span class='op'>[]</span> <span class='id identifier rubyid_name'>name</span> <span class='id identifier rubyid_send'>send</span> <span class='id identifier rubyid_name'>name</span> <span class='kw'>end</span></pre> @@ -967,12 +988,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>hash-like attribtue setter</p> + <p>hash-like attribute setter</p> </div> </div> <div class="tags"> @@ -982,17 +1002,17 @@ <tr> <td> <pre class="lines"> -127 128 129 -130</pre> +130 +131</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 127</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 128</span> <span class='kw'>def</span> <span class='op'>[]=</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='kw'>end</span></pre> @@ -1010,13 +1030,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>returns a hash which can be serialized as json. this is for use in rails -controllers: `render json: blobject`</p> + <p>for rails: <code>render json: blobject</code></p> </div> </div> <div class="tags"> @@ -1026,17 +1044,17 @@ <tr> <td> <pre class="lines"> -141 -142 -143 -144</pre> +147 +148 +149 +150</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 141</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 147</span> <span class='kw'>def</span> <span class='id identifier rubyid_as_json'>as_json</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span> <span class='kw'>return</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_as_json'>as_json</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='symbol'>:as_json</span> <span class='id identifier rubyid_to_hash'>to_hash</span> <span class='kw'>end</span></pre> @@ -1044,22 +1062,74 @@ </tr> </table> </div> <div class="method_details "> + <h3 class="signature " id="empty?-instance_method"> + + - (<tt>Boolean</tt>) <strong>empty?</strong> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + <p>indicates whether the blobject contains any data</p> + + + </div> +</div> +<div class="tags"> + +<p class="tag_title">Returns:</p> +<ul class="return"> + + <li> + + + <span class='type'>(<tt>Boolean</tt>)</span> + + + + </li> + +</ul> + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +31 +32 +33</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 31</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span> + <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> <h3 class="signature " id="freeze-instance_method"> - (<tt>Object</tt>) <strong>freeze</strong> </h3><div class="docstring"> <div class="discussion"> - -<p>freeze a Blobject to prevent it being modified</p> + <p>freeze a Blobject to prevent it being modified</p> </div> </div> <div class="tags"> @@ -1069,42 +1139,81 @@ <tr> <td> <pre class="lines"> -133 134 135 136 137</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 133</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 134</span> <span class='kw'>def</span> <span class='id identifier rubyid_freeze'>freeze</span> - <span class='id identifier rubyid___visit_subtree__'>__visit_subtree__</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='op'>|</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span> <span class='rbrace'>}</span> <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span> <span class='kw'>super</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> + <h3 class="signature " id="freeze_r-instance_method"> + + - (<tt>Object</tt>) <strong>freeze_r</strong> + + + + + +</h3><div class="docstring"> + <div class="discussion"> + <p>recursively freeze the Blobject include nest Blobjects in arrays</p> + + + </div> +</div> +<div class="tags"> + + +</div><table class="source_code"> + <tr> + <td> + <pre class="lines"> + + +140 +141 +142 +143</pre> + </td> + <td> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 140</span> + +<span class='kw'>def</span> <span class='id identifier rubyid_freeze_r'>freeze_r</span> + <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:__freeze_r__</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> + <span class='id identifier rubyid_freeze'>freeze</span> +<span class='kw'>end</span></pre> + </td> + </tr> +</table> +</div> + + <div class="method_details "> <h3 class="signature " id="hash-instance_method"> - (<tt>Object</tt>) <strong>hash</strong> </h3><div class="docstring"> <div class="discussion"> - -<p>access the internal hash. be careful, this is <em>not</em> a copy</p> + <p>access the internal hash. be careful, this is <em>not</em> a copy</p> </div> </div> <div class="tags"> @@ -1142,12 +1251,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>delegates to the internal Hash</p> + <p>delegates to the internal Hash</p> </div> </div> <div class="tags"> @@ -1211,24 +1319,24 @@ <tr> <td> <pre class="lines"> -101 102 103 104 105 106 107 108 109 110 -111</pre> +111 +112</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 101</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 102</span> <span class='kw'>def</span> <span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='id identifier rubyid_method'>method</span> <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_methods'>methods</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='const'>ProhibitedNames</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='rparen'>)</span> @@ -1253,12 +1361,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>creates a recursive copy of the internal hash</p> + <p>creates a recursive copy of the internal hash</p> </div> </div> <div class="tags"> @@ -1283,11 +1390,11 @@ <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 48</span> <span class='kw'>def</span> <span class='id identifier rubyid_to_hash'>to_hash</span> <span class='id identifier rubyid_h'>h</span> <span class='op'>=</span> <span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span> - <span class='id identifier rubyid___visit_subtree__'>__visit_subtree__</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='op'>|</span> + <span class='ivar'>@hash</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_node'>node</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span> <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span> <span class='symbol'>:to_hash</span> <span class='kw'>end</span> <span class='id identifier rubyid_h'>h</span> <span class='kw'>end</span></pre> </td> @@ -1304,12 +1411,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>serialize the Blobject as a json string</p> + <p>serialize the Blobject as a json string</p> </div> </div> <div class="tags"> @@ -1319,16 +1425,16 @@ <tr> <td> <pre class="lines"> -147 -148 -149</pre> +153 +154 +155</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 147</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 153</span> <span class='kw'>def</span> <span class='id identifier rubyid_to_json'>to_json</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span> <span class='id identifier rubyid_as_json'>as_json</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span> <span class='kw'>end</span></pre> </td> @@ -1345,12 +1451,11 @@ </h3><div class="docstring"> <div class="discussion"> - -<p>serialize the Blobject as a yaml string</p> + <p>serialize the Blobject as a yaml string</p> </div> </div> <div class="tags"> @@ -1360,17 +1465,17 @@ <tr> <td> <pre class="lines"> -152 -153 -154 -155</pre> +158 +159 +160 +161</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 152</span> + <pre class="code"><span class="info file"># File 'lib/blobject.rb', line 158</span> <span class='kw'>def</span> <span class='id identifier rubyid_to_yaml'>to_yaml</span> <span class='id identifier rubyid_as_yaml'>as_yaml</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span> <span class='kw'>end</span></pre> @@ -1382,10 +1487,10 @@ </div> </div> <div id="footer"> - Generated on Thu Jun 7 00:25:32 2012 by + Generated on Sun Jun 17 00:20:42 2012 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.8.1 (ruby-1.9.3). </div> </body> \ No newline at end of file