summaryrefslogtreecommitdiff
path: root/doc/classes/JSON/Ext/Generator/State.src/M000137.html
blob: 20d3d0ffa1f1f5ca47abbbff6466436067be2201 (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
<?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>
<head>
  <title>to_h (JSON::Ext::Generator::State)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre>/*
 * call-seq: to_h
 *
 * Returns the configuration instance variables as a hash, that can be
 * passed to the configure method.
 */
static VALUE cState_to_h(VALUE self)
{
    VALUE result = rb_hash_new();
    GET_STATE(self);
    rb_hash_aset(result, ID2SYM(i_indent), rb_str_new(state-&gt;indent, state-&gt;indent_len));
    rb_hash_aset(result, ID2SYM(i_space), rb_str_new(state-&gt;space, state-&gt;space_len));
    rb_hash_aset(result, ID2SYM(i_space_before), rb_str_new(state-&gt;space_before, state-&gt;space_before_len));
    rb_hash_aset(result, ID2SYM(i_object_nl), rb_str_new(state-&gt;object_nl, state-&gt;object_nl_len));
    rb_hash_aset(result, ID2SYM(i_array_nl), rb_str_new(state-&gt;array_nl, state-&gt;array_nl_len));
    rb_hash_aset(result, ID2SYM(i_allow_nan), state-&gt;allow_nan ? Qtrue : Qfalse);
    rb_hash_aset(result, ID2SYM(i_ascii_only), state-&gt;ascii_only ? Qtrue : Qfalse);
    rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state-&gt;max_nesting));
    return result;
}</pre>
</body>
</html>