summaryrefslogtreecommitdiff
path: root/doc/classes/JSON/Ext/Generator/State.html
blob: b5d28d8a1424c0ff3ffd262fe98c5c3b01005094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>Class: JSON::Ext::Generator::State</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">JSON::Ext::Generator::State</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/ext/json/ext/generator_c.html">
                ext/json/ext/generator.c
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000134">allow_nan?</a>&nbsp;&nbsp;
      <a href="#M000130">array_nl</a>&nbsp;&nbsp;
      <a href="#M000131">array_nl=</a>&nbsp;&nbsp;
      <a href="#M000135">ascii_only?</a>&nbsp;&nbsp;
      <a href="#M000136">configure</a>&nbsp;&nbsp;
      <a href="#M000119">from_state</a>&nbsp;&nbsp;
      <a href="#M000138">generate</a>&nbsp;&nbsp;
      <a href="#M000122">indent</a>&nbsp;&nbsp;
      <a href="#M000123">indent=</a>&nbsp;&nbsp;
      <a href="#M000121">initialize_copy</a>&nbsp;&nbsp;
      <a href="#M000132">max_nesting</a>&nbsp;&nbsp;
      <a href="#M000133">max_nesting=</a>&nbsp;&nbsp;
      <a href="#M000120">new</a>&nbsp;&nbsp;
      <a href="#M000128">object_nl</a>&nbsp;&nbsp;
      <a href="#M000129">object_nl=</a>&nbsp;&nbsp;
      <a href="#M000139">partial_generate</a>&nbsp;&nbsp;
      <a href="#M000124">space</a>&nbsp;&nbsp;
      <a href="#M000125">space=</a>&nbsp;&nbsp;
      <a href="#M000126">space_before</a>&nbsp;&nbsp;
      <a href="#M000127">space_before=</a>&nbsp;&nbsp;
      <a href="#M000137">to_h</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000119" class="method-detail">
        <a name="M000119"></a>

        <div class="method-heading">
          <a href="State.src/M000119.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000119.html');return false;">
          <span class="method-name"> from_state(opts)<br />
</span>
          </a>
        </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 <a href="State.html#M000120">new</a> <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>
      </div>

      <div id="method-M000120" class="method-detail">
        <a name="M000120"></a>

        <div class="method-heading">
          <a href="State.src/M000120.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000120.html');return false;">
          <span class="method-name"> new(opts = {})<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Instantiates a <a href="State.html#M000120">new</a> <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><a href="State.html#M000122">indent</a></b>: a string used to <a
href="State.html#M000122">indent</a> levels (default: &#8217;&#8217;),

</li>
<li><b><a href="State.html#M000124">space</a></b>: a string that is put after,
a : or , delimiter (default: &#8217;&#8217;),

</li>
<li><b><a href="State.html#M000126">space_before</a></b>: a string that is put
before a : pair delimiter (default: &#8217;&#8217;),

</li>
<li><b><a href="State.html#M000128">object_nl</a></b>: a string that is put at
the end of a <a href="../../../JSON.html">JSON</a> object (default:
&#8217;&#8217;),

</li>
<li><b><a href="State.html#M000130">array_nl</a></b>: a string that is put at
the end of a <a href="../../../JSON.html">JSON</a> array (default:
&#8217;&#8217;),

</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>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000134" class="method-detail">
        <a name="M000134"></a>

        <div class="method-heading">
          <a href="State.src/M000134.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000134.html');return false;">
          <span class="method-name"> allow_nan?<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns true, if NaN, Infinity, and -Infinity should be generated,
otherwise returns false.
</p>
        </div>
      </div>

      <div id="method-M000130" class="method-detail">
        <a name="M000130"></a>

        <div class="method-heading">
          <a href="State.src/M000130.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000130.html');return false;">
          <span class="method-name"> array_nl()<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000131" class="method-detail">
        <a name="M000131"></a>

        <div class="method-heading">
          <a href="State.src/M000131.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000131.html');return false;">
          <span class="method-name"> array_nl=(array_nl)<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000135" class="method-detail">
        <a name="M000135"></a>

        <div class="method-heading">
          <a href="State.src/M000135.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000135.html');return false;">
          <span class="method-name"> ascii_only?<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns true, if NaN, Infinity, and -Infinity should be generated,
otherwise returns false.
</p>
        </div>
      </div>

      <div id="method-M000136" class="method-detail">
        <a name="M000136"></a>

        <div class="method-heading">
          <a href="State.src/M000136.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000136.html');return false;">
          <span class="method-name"> configure(opts)<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000138" class="method-detail">
        <a name="M000138"></a>

        <div class="method-heading">
          <a href="State.src/M000138.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000138.html');return false;">
          <span class="method-name"> generate(obj)<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000122" class="method-detail">
        <a name="M000122"></a>

        <div class="method-heading">
          <a href="State.src/M000122.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000122.html');return false;">
          <span class="method-name"> indent()<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This string is used to <a href="State.html#M000122">indent</a> levels in
the <a href="../../../JSON.html">JSON</a> text.
</p>
        </div>
      </div>

      <div id="method-M000123" class="method-detail">
        <a name="M000123"></a>

        <div class="method-heading">
          <a href="State.src/M000123.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000123.html');return false;">
          <span class="method-name"> indent=(indent)<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This string is used to <a href="State.html#M000122">indent</a> levels in
the <a href="../../../JSON.html">JSON</a> text.
</p>
        </div>
      </div>

      <div id="method-M000121" class="method-detail">
        <a name="M000121"></a>

        <div class="method-heading">
          <a href="State.src/M000121.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000121.html');return false;">
          <span class="method-name"> initialize_copy(orig)<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Initializes this object from orig if it to be duplicated/cloned and returns
it.
</p>
        </div>
      </div>

      <div id="method-M000132" class="method-detail">
        <a name="M000132"></a>

        <div class="method-heading">
          <a href="State.src/M000132.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000132.html');return false;">
          <span class="method-name"> max_nesting<br />
</span>
          </a>
        </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#M000132">max_nesting</a> = 0 if no maximum is checked.
</p>
        </div>
      </div>

      <div id="method-M000133" class="method-detail">
        <a name="M000133"></a>

        <div class="method-heading">
          <a href="State.src/M000133.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000133.html');return false;">
          <span class="method-name"> max_nesting=(depth)<br />
</span>
          </a>
        </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#M000132">max_nesting</a> = 0 if no maximum should be
checked.
</p>
        </div>
      </div>

      <div id="method-M000128" class="method-detail">
        <a name="M000128"></a>

        <div class="method-heading">
          <a href="State.src/M000128.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000128.html');return false;">
          <span class="method-name"> object_nl()<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000129" class="method-detail">
        <a name="M000129"></a>

        <div class="method-heading">
          <a href="State.src/M000129.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000129.html');return false;">
          <span class="method-name"> object_nl=(object_nl)<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000139" class="method-detail">
        <a name="M000139"></a>

        <div class="method-heading">
          <a href="State.src/M000139.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000139.html');return false;">
          <span class="method-name"> partial_generate(obj)<br />
</span>
          </a>
        </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>
      </div>

      <div id="method-M000124" class="method-detail">
        <a name="M000124"></a>

        <div class="method-heading">
          <a href="State.src/M000124.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000124.html');return false;">
          <span class="method-name"> space()<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This string is used to insert a <a href="State.html#M000124">space</a>
between the tokens in a <a href="../../../JSON.html">JSON</a> string.
</p>
        </div>
      </div>

      <div id="method-M000125" class="method-detail">
        <a name="M000125"></a>

        <div class="method-heading">
          <a href="State.src/M000125.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000125.html');return false;">
          <span class="method-name"> space=(space)<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This string is used to insert a <a href="State.html#M000124">space</a>
between the tokens in a <a href="../../../JSON.html">JSON</a> string.
</p>
        </div>
      </div>

      <div id="method-M000126" class="method-detail">
        <a name="M000126"></a>

        <div class="method-heading">
          <a href="State.src/M000126.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000126.html');return false;">
          <span class="method-name"> space_before()<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This string is used to insert a <a href="State.html#M000124">space</a>
before the &#8217;:&#8217; in <a href="../../../JSON.html">JSON</a>
objects.
</p>
        </div>
      </div>

      <div id="method-M000127" class="method-detail">
        <a name="M000127"></a>

        <div class="method-heading">
          <a href="State.src/M000127.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000127.html');return false;">
          <span class="method-name"> space_before=(space_before)<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
This string is used to insert a <a href="State.html#M000124">space</a>
before the &#8217;:&#8217; in <a href="../../../JSON.html">JSON</a>
objects.
</p>
        </div>
      </div>

      <div id="method-M000137" class="method-detail">
        <a name="M000137"></a>

        <div class="method-heading">
          <a href="State.src/M000137.html" target="Code" class="method-signature"
            onclick="popupCode('State.src/M000137.html');return false;">
          <span class="method-name"> to_h<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the configuration instance variables as a hash, that can be passed
to the <a href="State.html#M000136">configure</a> method.
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>