ruby-json 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +504 -0
- data/README +16 -0
- data/doc/classes/Array.html +162 -0
- data/doc/classes/Array.src/M000011.html +27 -0
- data/doc/classes/Array.src/M000012.html +32 -0
- data/doc/classes/ArrayTest.html +129 -0
- data/doc/classes/ArrayTest.src/M000014.html +28 -0
- data/doc/classes/FalseClass.html +131 -0
- data/doc/classes/FalseClass.src/M000013.html +18 -0
- data/doc/classes/Hash.html +156 -0
- data/doc/classes/Hash.src/M000009.html +29 -0
- data/doc/classes/Hash.src/M000010.html +45 -0
- data/doc/classes/JSON.html +103 -0
- data/doc/classes/JSON/Lexer.html +411 -0
- data/doc/classes/JSON/Lexer.src/M000022.html +19 -0
- data/doc/classes/JSON/Lexer.src/M000023.html +18 -0
- data/doc/classes/JSON/Lexer.src/M000024.html +18 -0
- data/doc/classes/JSON/Lexer.src/M000025.html +20 -0
- data/doc/classes/JSON/Lexer.src/M000026.html +20 -0
- data/doc/classes/JSON/Lexer.src/M000027.html +21 -0
- data/doc/classes/JSON/Lexer.src/M000028.html +43 -0
- data/doc/classes/JSON/Lexer.src/M000029.html +67 -0
- data/doc/classes/JSON/Lexer.src/M000030.html +46 -0
- data/doc/classes/JSON/Lexer.src/M000031.html +26 -0
- data/doc/classes/JSON/Lexer.src/M000032.html +61 -0
- data/doc/classes/JSON/Lexer.src/M000033.html +29 -0
- data/doc/classes/JSON/Lexer.src/M000034.html +18 -0
- data/doc/classes/JSON/Lexer.src/M000035.html +19 -0
- data/doc/classes/JSON/Lexer.src/M000036.html +20 -0
- data/doc/classes/LexerTest.html +219 -0
- data/doc/classes/LexerTest.src/M000002.html +24 -0
- data/doc/classes/LexerTest.src/M000003.html +22 -0
- data/doc/classes/LexerTest.src/M000004.html +26 -0
- data/doc/classes/LexerTest.src/M000005.html +23 -0
- data/doc/classes/LexerTest.src/M000006.html +31 -0
- data/doc/classes/LexerTest.src/M000007.html +27 -0
- data/doc/classes/LexerTest.src/M000008.html +58 -0
- data/doc/classes/NilClass.html +131 -0
- data/doc/classes/NilClass.src/M000017.html +18 -0
- data/doc/classes/Numeric.html +131 -0
- data/doc/classes/Numeric.src/M000016.html +18 -0
- data/doc/classes/Object.html +176 -0
- data/doc/classes/Object.src/M000018.html +18 -0
- data/doc/classes/ObjectTest.html +129 -0
- data/doc/classes/ObjectTest.src/M000015.html +28 -0
- data/doc/classes/String.html +151 -0
- data/doc/classes/String.src/M000019.html +18 -0
- data/doc/classes/String.src/M000020.html +46 -0
- data/doc/classes/TrueClass.html +131 -0
- data/doc/classes/TrueClass.src/M000021.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/install_rb.html +194 -0
- data/doc/files/install_rb.src/M000001.html +43 -0
- data/doc/files/json/lexer_rb.html +156 -0
- data/doc/files/json/objects_rb.html +154 -0
- data/doc/files/test/arraytest_rb.html +150 -0
- data/doc/files/test/lexertest_rb.html +150 -0
- data/doc/files/test/objtest_rb.html +150 -0
- data/doc/fr_class_index.html +39 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +62 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +175 -0
- data/install.rb +67 -0
- data/lib/json/lexer.rb +297 -0
- data/lib/json/objects.rb +201 -0
- data/ruby-json.gemspec +25 -0
- data/test/arraytest.rb +45 -0
- data/test/lexertest.rb +146 -0
- data/test/objtest.rb +45 -0
- metadata +126 -0
data/README
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
JSON for Ruby is a serializer and deserializer library for JSON for Ruby
|
3
|
+
programming language. The JavaScript Object Notation (JSON) is a lightweight
|
4
|
+
data interchange format that is presented as an alternative to XML for
|
5
|
+
that application. For more information on JSON, visit the JSON website at
|
6
|
+
http://www.crockford.com/JSON/index.html.
|
7
|
+
|
8
|
+
To install the library, run as root the script install.rb.
|
9
|
+
|
10
|
+
Read the RDoc documentation in ./doc for more information on the API, and
|
11
|
+
look at the unit tests in ./test for more information on how to use the
|
12
|
+
library.
|
13
|
+
|
14
|
+
Thanks to Adam Kramer for some serious changes for the better.
|
15
|
+
|
16
|
+
$Id: README,v 1.2 2005/01/28 02:46:22 didosevilla Exp $
|
@@ -0,0 +1,162 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Array</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<h1>Array <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../files/json/objects_rb.html">
|
56
|
+
json/objects.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
<a href="Object.html">
|
66
|
+
Object
|
67
|
+
</a>
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
<!-- banner header -->
|
73
|
+
|
74
|
+
<div id="bodyContent">
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="method-list">
|
82
|
+
<h2 class="section-bar">Methods</h2>
|
83
|
+
|
84
|
+
<div class="name-list">
|
85
|
+
<a href="#M000012">from_json</a>
|
86
|
+
<a href="#M000011">to_json</a>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if method_list -->
|
103
|
+
<div id="methods">
|
104
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
105
|
+
|
106
|
+
<div id="method-M000012" class="method-detail">
|
107
|
+
<a name="M000012"></a>
|
108
|
+
|
109
|
+
<div class="method-heading">
|
110
|
+
<a href="Array.src/M000012.html" target="Code" class="method-signature"
|
111
|
+
onclick="popupCode('Array.src/M000012.html');return false;">
|
112
|
+
<span class="method-name">from_json</span><span class="method-args">(lexer)</span>
|
113
|
+
</a>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="method-description">
|
117
|
+
<p>
|
118
|
+
This method will parse a JSON array from the passed lexer object. It takes
|
119
|
+
a lexer object which is about to read a JSON array. It raises a runtime
|
120
|
+
error otherwise. It returns the original JSON array. This method is not
|
121
|
+
intended to be used directly.
|
122
|
+
</p>
|
123
|
+
<h5>Parameters</h5>
|
124
|
+
<table>
|
125
|
+
<tr><td valign="top"><tt>lexer</tt>:</td><td>Lexer object to use
|
126
|
+
|
127
|
+
</td></tr>
|
128
|
+
</table>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div id="method-M000011" class="method-detail">
|
133
|
+
<a name="M000011"></a>
|
134
|
+
|
135
|
+
<div class="method-heading">
|
136
|
+
<a href="Array.src/M000011.html" target="Code" class="method-signature"
|
137
|
+
onclick="popupCode('Array.src/M000011.html');return false;">
|
138
|
+
<span class="method-name">to_json</span><span class="method-args">()</span>
|
139
|
+
</a>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div class="method-description">
|
143
|
+
<p>
|
144
|
+
This method will return a string giving the contents of the JSON array in
|
145
|
+
standard JSON format.
|
146
|
+
</p>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
</div>
|
155
|
+
|
156
|
+
|
157
|
+
<div id="validator-badges">
|
158
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
</body>
|
162
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>to_json (Array)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File json/objects.rb, line 103</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_json</span>
|
15
|
+
<span class="ruby-identifier">retval</span> = <span class="ruby-value str">'['</span>
|
16
|
+
|
17
|
+
<span class="ruby-identifier">first</span>=<span class="ruby-keyword kw">true</span>
|
18
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
19
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">','</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">first</span>
|
20
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_json</span>
|
21
|
+
<span class="ruby-identifier">first</span>=<span class="ruby-keyword kw">false</span>
|
22
|
+
}
|
23
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"]"</span>
|
24
|
+
<span class="ruby-keyword kw">return</span>(<span class="ruby-identifier">retval</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span></pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>from_json (Array)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File json/objects.rb, line 123</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_json</span>(<span class="ruby-identifier">lexer</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"A JSON Array must begin with '['"</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">"["</span>)
|
16
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span> <span class="ruby-operator">==</span> <span class="ruby-value str">']'</span>
|
17
|
+
<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">back</span>
|
18
|
+
<span class="ruby-identifier">loop</span> {
|
19
|
+
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextvalue</span>
|
20
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span>
|
21
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">','</span>
|
22
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span> <span class="ruby-operator">==</span> <span class="ruby-value str">']'</span>)
|
23
|
+
<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">back</span>
|
24
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">']'</span>
|
25
|
+
<span class="ruby-keyword kw">return</span>(<span class="ruby-keyword kw">self</span>)
|
26
|
+
<span class="ruby-keyword kw">else</span>
|
27
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Expected a ',' or ']'"</span>
|
28
|
+
<span class="ruby-keyword kw">end</span>
|
29
|
+
}
|
30
|
+
<span class="ruby-keyword kw">end</span></pre>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,129 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ArrayTest</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<h1>ArrayTest <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../files/test/arraytest_rb.html">
|
56
|
+
test/arraytest.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
Test::Unit::TestCase
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
</table>
|
69
|
+
</div>
|
70
|
+
<!-- banner header -->
|
71
|
+
|
72
|
+
<div id="bodyContent">
|
73
|
+
|
74
|
+
|
75
|
+
<div id="contextContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h2 class="section-bar">Methods</h2>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000014">test_array_to_json</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if method_list -->
|
100
|
+
<div id="methods">
|
101
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
102
|
+
|
103
|
+
<div id="method-M000014" class="method-detail">
|
104
|
+
<a name="M000014"></a>
|
105
|
+
|
106
|
+
<div class="method-heading">
|
107
|
+
<a href="ArrayTest.src/M000014.html" target="Code" class="method-signature"
|
108
|
+
onclick="popupCode('ArrayTest.src/M000014.html');return false;">
|
109
|
+
<span class="method-name">test_array_to_json</span><span class="method-args">()</span>
|
110
|
+
</a>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div class="method-description">
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<div id="validator-badges">
|
125
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
</body>
|
129
|
+
</html>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>test_array_to_json (ArrayTest)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File test/arraytest.rb, line 32</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_array_to_json</span>
|
15
|
+
<span class="ruby-identifier">array</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
16
|
+
<span class="ruby-identifier">array</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">'bar'</span>
|
17
|
+
<span class="ruby-identifier">array</span>[<span class="ruby-value">1</span>] = <span class="ruby-value">1</span>
|
18
|
+
<span class="ruby-identifier">array</span>[<span class="ruby-value">2</span>] = <span class="ruby-value">2.7182818</span>
|
19
|
+
|
20
|
+
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">array</span>.<span class="ruby-identifier">to_json</span>
|
21
|
+
<span class="ruby-identifier">sarray</span> = <span class="ruby-constant">JSON</span><span class="ruby-operator">::</span><span class="ruby-constant">Lexer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">str</span>).<span class="ruby-identifier">nextvalue</span>
|
22
|
+
<span class="ruby-identifier">assert</span>(<span class="ruby-identifier">sarray</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span>, <span class="ruby-value str">"array was not generated by deserialization"</span>)
|
23
|
+
<span class="ruby-identifier">assert</span>(<span class="ruby-identifier">sarray</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'bar'</span>, <span class="ruby-value str">"error in serialization of a string to JSON"</span>)
|
24
|
+
<span class="ruby-identifier">assert</span>(<span class="ruby-identifier">sarray</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>, <span class="ruby-value str">"error in serialization of a FixNum to JSON"</span>)
|
25
|
+
<span class="ruby-identifier">assert</span>(<span class="ruby-identifier">sarray</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-value">2.7182818</span>, <span class="ruby-value str">"error in serialization of a float to JSON"</span>)
|
26
|
+
<span class="ruby-keyword kw">end</span></pre>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: FalseClass</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<h1>FalseClass <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../files/json/objects_rb.html">
|
56
|
+
json/objects.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
<a href="Object.html">
|
66
|
+
Object
|
67
|
+
</a>
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
<!-- banner header -->
|
73
|
+
|
74
|
+
<div id="bodyContent">
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="method-list">
|
82
|
+
<h2 class="section-bar">Methods</h2>
|
83
|
+
|
84
|
+
<div class="name-list">
|
85
|
+
<a href="#M000013">to_json</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
104
|
+
|
105
|
+
<div id="method-M000013" class="method-detail">
|
106
|
+
<a name="M000013"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="FalseClass.src/M000013.html" target="Code" class="method-signature"
|
110
|
+
onclick="popupCode('FalseClass.src/M000013.html');return false;">
|
111
|
+
<span class="method-name">to_json</span><span class="method-args">()</span>
|
112
|
+
</a>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="method-description">
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
</div>
|
124
|
+
|
125
|
+
|
126
|
+
<div id="validator-badges">
|
127
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</body>
|
131
|
+
</html>
|