formattedstring 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -0
- data/Rakefile +1 -1
- data/doc/classes/Enumerable.html +146 -0
- data/doc/classes/Enumerable.src/M000029.html +21 -0
- data/doc/classes/Enumerable.src/M000030.html +34 -0
- data/doc/classes/FormattedString.html +119 -0
- data/doc/classes/FormattedString/Formats.html +121 -0
- data/doc/classes/FormattedString/Formats/Json.html +159 -0
- data/doc/classes/FormattedString/Formats/Json.src/M000006.html +18 -0
- data/doc/classes/FormattedString/Formats/Json.src/M000007.html +18 -0
- data/doc/classes/FormattedString/Formats/Xml.html +159 -0
- data/doc/classes/FormattedString/Formats/Xml.src/M000004.html +18 -0
- data/doc/classes/FormattedString/Formats/Xml.src/M000005.html +52 -0
- data/doc/classes/FormattedString/Formats/Yaml.html +131 -0
- data/doc/classes/FormattedString/Formats/Yaml.src/M000008.html +18 -0
- data/doc/classes/Inflector.html +516 -0
- data/doc/classes/Inflector.src/M000009.html +22 -0
- data/doc/classes/Inflector.src/M000010.html +25 -0
- data/doc/classes/Inflector.src/M000011.html +25 -0
- data/doc/classes/Inflector.src/M000012.html +22 -0
- data/doc/classes/Inflector.src/M000013.html +18 -0
- data/doc/classes/Inflector.src/M000014.html +22 -0
- data/doc/classes/Inflector.src/M000015.html +18 -0
- data/doc/classes/Inflector.src/M000016.html +18 -0
- data/doc/classes/Inflector.src/M000017.html +18 -0
- data/doc/classes/Inflector.src/M000018.html +18 -0
- data/doc/classes/Inflector.src/M000019.html +19 -0
- data/doc/classes/Inflector.src/M000020.html +18 -0
- data/doc/classes/Inflector.src/M000021.html +22 -0
- data/doc/classes/Inflector.src/M000022.html +27 -0
- data/doc/classes/Inflector/Inflections.html +321 -0
- data/doc/classes/Inflector/Inflections.src/M000023.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000024.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000025.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000026.html +26 -0
- data/doc/classes/Inflector/Inflections.src/M000027.html +18 -0
- data/doc/classes/Inflector/Inflections.src/M000028.html +23 -0
- data/doc/classes/String.html +191 -0
- data/doc/classes/String.src/M000001.html +18 -0
- data/doc/classes/String.src/M000002.html +20 -0
- data/doc/classes/String.src/M000003.html +19 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +129 -0
- data/doc/files/README.html +201 -0
- data/doc/files/lib/formatted_string/formats/json_rb.html +108 -0
- data/doc/files/lib/formatted_string/formats/xml_rb.html +119 -0
- data/doc/files/lib/formatted_string/formats/yaml_rb.html +101 -0
- data/doc/files/lib/formatted_string_rb.html +108 -0
- data/doc/files/lib/inflections_rb.html +101 -0
- data/doc/files/lib/inflector_rb.html +108 -0
- data/doc/fr_class_index.html +35 -0
- data/doc/fr_file_index.html +34 -0
- data/doc/fr_method_index.html +56 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/formatted_string/formats/json.rb +20 -0
- data/lib/formatted_string/formats/xml.rb +8 -5
- data/lib/formatted_string/formats/yaml.rb +9 -0
- metadata +72 -2
@@ -0,0 +1,159 @@
|
|
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>Module: FormattedString::Formats::Json</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
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">FormattedString::Formats::Json</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/formatted_string/formats/json_rb.html">
|
59
|
+
lib/formatted_string/formats/json.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000006">===</a>
|
84
|
+
<a href="#M000007">to_hash</a>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
<!-- if includes -->
|
92
|
+
|
93
|
+
<div id="section">
|
94
|
+
|
95
|
+
|
96
|
+
<div id="constants-list">
|
97
|
+
<h3 class="section-bar">Constants</h3>
|
98
|
+
|
99
|
+
<div class="name-list">
|
100
|
+
<table summary="Constants">
|
101
|
+
<tr class="top-aligned-row context-row">
|
102
|
+
<td class="context-item-name">JSON_OPTIONS</td>
|
103
|
+
<td>=</td>
|
104
|
+
<td class="context-item-value">{ :include_key => true, # Can be true or false :key_name => 'id', # Default key name }</td>
|
105
|
+
</tr>
|
106
|
+
</table>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<!-- if method_list -->
|
116
|
+
<div id="methods">
|
117
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
118
|
+
|
119
|
+
<div id="method-M000006" class="method-detail">
|
120
|
+
<a name="M000006"></a>
|
121
|
+
|
122
|
+
<div class="method-heading">
|
123
|
+
<a href="Json.src/M000006.html" target="Code" class="method-signature"
|
124
|
+
onclick="popupCode('Json.src/M000006.html');return false;">
|
125
|
+
<span class="method-name">===</span><span class="method-args">(other)</span>
|
126
|
+
</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="method-description">
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div id="method-M000007" class="method-detail">
|
134
|
+
<a name="M000007"></a>
|
135
|
+
|
136
|
+
<div class="method-heading">
|
137
|
+
<a href="Json.src/M000007.html" target="Code" class="method-signature"
|
138
|
+
onclick="popupCode('Json.src/M000007.html');return false;">
|
139
|
+
<span class="method-name">to_hash</span><span class="method-args">(options={})</span>
|
140
|
+
</a>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div class="method-description">
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
<div id="validator-badges">
|
155
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
</body>
|
159
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>=== (FormattedString::Formats::Json)</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 lib/formatted_string/formats/json.rb, line 11</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
<span class="ruby-identifier">to_hash</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_hash</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_hash (FormattedString::Formats::Json)</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 lib/formatted_string/formats/json.rb, line 15</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>(<span class="ruby-identifier">options</span>={})
|
15
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-keyword kw">self</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,159 @@
|
|
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>Module: FormattedString::Formats::Xml</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
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">FormattedString::Formats::Xml</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/formatted_string/formats/xml_rb.html">
|
59
|
+
lib/formatted_string/formats/xml.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000004">===</a>
|
84
|
+
<a href="#M000005">to_hash</a>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
<!-- if includes -->
|
92
|
+
|
93
|
+
<div id="section">
|
94
|
+
|
95
|
+
|
96
|
+
<div id="constants-list">
|
97
|
+
<h3 class="section-bar">Constants</h3>
|
98
|
+
|
99
|
+
<div class="name-list">
|
100
|
+
<table summary="Constants">
|
101
|
+
<tr class="top-aligned-row context-row">
|
102
|
+
<td class="context-item-name">XML_OPTIONS</td>
|
103
|
+
<td>=</td>
|
104
|
+
<td class="context-item-value">{ :include_key => :attribute, # Can be false, :element, or :attribute :report_nil => true, # Sets an attribute nil="true" on elements that are nil, so that the reader doesn't read as an empty string :key_name => 'id', # Default key name }</td>
|
105
|
+
</tr>
|
106
|
+
</table>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<!-- if method_list -->
|
116
|
+
<div id="methods">
|
117
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
118
|
+
|
119
|
+
<div id="method-M000004" class="method-detail">
|
120
|
+
<a name="M000004"></a>
|
121
|
+
|
122
|
+
<div class="method-heading">
|
123
|
+
<a href="Xml.src/M000004.html" target="Code" class="method-signature"
|
124
|
+
onclick="popupCode('Xml.src/M000004.html');return false;">
|
125
|
+
<span class="method-name">===</span><span class="method-args">(other)</span>
|
126
|
+
</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="method-description">
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div id="method-M000005" class="method-detail">
|
134
|
+
<a name="M000005"></a>
|
135
|
+
|
136
|
+
<div class="method-heading">
|
137
|
+
<a href="Xml.src/M000005.html" target="Code" class="method-signature"
|
138
|
+
onclick="popupCode('Xml.src/M000005.html');return false;">
|
139
|
+
<span class="method-name">to_hash</span><span class="method-args">(options={})</span>
|
140
|
+
</a>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div class="method-description">
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
<div id="validator-badges">
|
155
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
</body>
|
159
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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>=== (FormattedString::Formats::Xml)</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 lib/formatted_string/formats/xml.rb, line 127</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">other</span>)
|
15
|
+
<span class="ruby-identifier">to_hash</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">to_hash</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,52 @@
|
|
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_hash (FormattedString::Formats::Xml)</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 lib/formatted_string/formats/xml.rb, line 131</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>(<span class="ruby-identifier">options</span>={})
|
15
|
+
<span class="ruby-identifier">options</span> = <span class="ruby-constant">XML_OPTIONS</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
16
|
+
|
17
|
+
<span class="ruby-identifier">stack</span> = []
|
18
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">Parsers</span><span class="ruby-operator">::</span><span class="ruby-constant">BaseParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
19
|
+
|
20
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
21
|
+
<span class="ruby-identifier">event</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">pull</span>
|
22
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">event</span>[<span class="ruby-value">0</span>]
|
23
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end_document</span>
|
24
|
+
<span class="ruby-keyword kw">break</span>
|
25
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end_doctype</span>, <span class="ruby-identifier">:start_doctype</span>
|
26
|
+
<span class="ruby-comment cmt"># do nothing</span>
|
27
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:start_element</span>
|
28
|
+
<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">push</span> <span class="ruby-constant">REXMLUtilityNode</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">event</span>[<span class="ruby-value">1</span>], <span class="ruby-identifier">event</span>[<span class="ruby-value">2</span>])
|
29
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end_element</span>
|
30
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
31
|
+
<span class="ruby-identifier">temp</span> = <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">pop</span>
|
32
|
+
<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">add_node</span>(<span class="ruby-identifier">temp</span>)
|
33
|
+
<span class="ruby-keyword kw">end</span>
|
34
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>, <span class="ruby-identifier">:cdata</span>
|
35
|
+
<span class="ruby-identifier">stack</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">add_node</span>(<span class="ruby-identifier">event</span>[<span class="ruby-value">1</span>]) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">event</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
36
|
+
<span class="ruby-keyword kw">end</span>
|
37
|
+
<span class="ruby-keyword kw">end</span>
|
38
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">stack</span>.<span class="ruby-identifier">pop</span>
|
39
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">to_hash</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_hash</span>)
|
40
|
+
|
41
|
+
<span class="ruby-comment cmt"># Turn any {} || {"nil" => "true"} into just nil</span>
|
42
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">data</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:crawl</span>) <span class="ruby-comment cmt"># basically, is it a hash or nil?</span>
|
43
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:report_nil</span>]
|
44
|
+
<span class="ruby-identifier">data</span>.<span class="ruby-identifier">crawl</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> {} <span class="ruby-operator">||</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> {<span class="ruby-value str">'nil'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'true'</span>}; <span class="ruby-identifier">v</span>}
|
45
|
+
<span class="ruby-keyword kw">else</span>
|
46
|
+
<span class="ruby-identifier">data</span>.<span class="ruby-identifier">crawl</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> {}; <span class="ruby-identifier">v</span>}
|
47
|
+
<span class="ruby-keyword kw">end</span>
|
48
|
+
<span class="ruby-keyword kw">end</span>
|
49
|
+
<span class="ruby-identifier">data</span>
|
50
|
+
<span class="ruby-keyword kw">end</span></pre>
|
51
|
+
</body>
|
52
|
+
</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>Module: FormattedString::Formats::Yaml</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
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">FormattedString::Formats::Yaml</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/formatted_string/formats/yaml_rb.html">
|
59
|
+
lib/formatted_string/formats/yaml.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000008">save</a>
|
84
|
+
</div>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- if includes -->
|
91
|
+
|
92
|
+
<div id="section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if method_list -->
|
102
|
+
<div id="methods">
|
103
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
+
|
105
|
+
<div id="method-M000008" class="method-detail">
|
106
|
+
<a name="M000008"></a>
|
107
|
+
|
108
|
+
<div class="method-heading">
|
109
|
+
<a href="Yaml.src/M000008.html" target="Code" class="method-signature"
|
110
|
+
onclick="popupCode('Yaml.src/M000008.html');return false;">
|
111
|
+
<span class="method-name">save</span><span class="method-args">(filename)</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>
|