sdl4r 0.9.3 → 0.9.4
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/CHANGELOG +13 -0
- data/README +2 -2
- data/Rakefile +3 -3
- data/TODO.txt +28 -11
- data/doc/classes/SDL4R.html +681 -0
- data/doc/classes/SDL4R/Parser.html +314 -0
- data/doc/classes/SDL4R/SdlBinary.html +303 -0
- data/doc/classes/SDL4R/SdlParseError.html +185 -0
- data/doc/classes/SDL4R/SdlTimeSpan.html +948 -0
- data/doc/classes/SDL4R/Tag.html +2028 -0
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +130 -0
- data/doc/files/LICENSE.html +756 -0
- data/doc/files/README.html +606 -0
- data/doc/files/lib/sdl4r/parser/reader_rb.html +108 -0
- data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +101 -0
- data/doc/files/lib/sdl4r/parser/token_rb.html +101 -0
- data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +101 -0
- data/doc/files/lib/sdl4r/parser_rb.html +108 -0
- data/doc/files/lib/sdl4r/sdl4r_rb.html +111 -0
- data/doc/files/lib/sdl4r/sdl_binary_rb.html +101 -0
- data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +101 -0
- data/doc/files/lib/sdl4r/sdl_time_span_rb.html +101 -0
- data/doc/files/lib/sdl4r/tag_rb.html +110 -0
- data/doc/files/lib/sdl4r_rb.html +101 -0
- data/doc/fr_file_index.html +2 -1
- data/doc/fr_method_index.html +88 -82
- data/lib/sdl4r.rb +18 -0
- data/lib/sdl4r/parser.rb +2 -9
- data/lib/sdl4r/{sdl.rb → sdl4r.rb} +46 -7
- data/lib/sdl4r/sdl_time_span.rb +6 -1
- data/lib/sdl4r/tag.rb +6 -7
- data/test/sdl4r/parser_test.rb +4 -16
- data/test/sdl4r/sdl4r_test.rb +3 -13
- data/test/sdl4r/sdl_test.rb +39 -0
- metadata +29 -6
@@ -0,0 +1,314 @@
|
|
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: SDL4R::Parser</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">SDL4R::Parser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/sdl4r/parser_rb.html">
|
59
|
+
lib/sdl4r/parser.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/sdl4r/parser/reader_rb.html">
|
63
|
+
lib/sdl4r/parser/reader.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../../files/lib/sdl4r/parser/tokenizer_rb.html">
|
67
|
+
lib/sdl4r/parser/tokenizer.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../../files/lib/sdl4r/parser/token_rb.html">
|
71
|
+
lib/sdl4r/parser/token.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../../files/lib/sdl4r/parser/time_span_with_zone_rb.html">
|
75
|
+
lib/sdl4r/parser/time_span_with_zone.rb
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
</td>
|
79
|
+
</tr>
|
80
|
+
|
81
|
+
<tr class="top-aligned-row">
|
82
|
+
<td><strong>Parent:</strong></td>
|
83
|
+
<td>
|
84
|
+
Object
|
85
|
+
</td>
|
86
|
+
</tr>
|
87
|
+
</table>
|
88
|
+
</div>
|
89
|
+
<!-- banner header -->
|
90
|
+
|
91
|
+
<div id="bodyContent">
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<div id="contextContent">
|
96
|
+
|
97
|
+
<div id="description">
|
98
|
+
<p>
|
99
|
+
The SDL parser.
|
100
|
+
</p>
|
101
|
+
<p>
|
102
|
+
In Ruby 1.8, in order to enable UTF-8 support, you may have to declare the
|
103
|
+
following lines:
|
104
|
+
</p>
|
105
|
+
<pre>
|
106
|
+
$KCODE = 'u'
|
107
|
+
require 'jcode'
|
108
|
+
</pre>
|
109
|
+
<p>
|
110
|
+
This will give you correct input and output and correct UTF-8
|
111
|
+
"general" sorting. Alternatively you can use the following
|
112
|
+
options when launching the Ruby interpreter:
|
113
|
+
</p>
|
114
|
+
<pre>
|
115
|
+
/path/to/ruby -Ku -rjcode
|
116
|
+
</pre>
|
117
|
+
<h2>Authors</h2>
|
118
|
+
<p>
|
119
|
+
Daniel Leuck, Philippe Vosges
|
120
|
+
</p>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div id="method-list">
|
128
|
+
<h3 class="section-bar">Methods</h3>
|
129
|
+
|
130
|
+
<div class="name-list">
|
131
|
+
<a href="#M000010">new</a>
|
132
|
+
<a href="#M000012">new_date_time</a>
|
133
|
+
<a href="#M000011">parse</a>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
|
140
|
+
<!-- if includes -->
|
141
|
+
|
142
|
+
<div id="section">
|
143
|
+
|
144
|
+
|
145
|
+
<div id="constants-list">
|
146
|
+
<h3 class="section-bar">Constants</h3>
|
147
|
+
|
148
|
+
<div class="name-list">
|
149
|
+
<table summary="Constants">
|
150
|
+
<tr class="top-aligned-row context-row">
|
151
|
+
<td class="context-item-name">UNKNOWN_POSITION</td>
|
152
|
+
<td>=</td>
|
153
|
+
<td class="context-item-value">-2</td>
|
154
|
+
<td width="3em"> </td>
|
155
|
+
<td class="context-item-desc">
|
156
|
+
Passed to parse_error() in order to specify an error that occured on no
|
157
|
+
specific position (column).
|
158
|
+
|
159
|
+
</td>
|
160
|
+
</tr>
|
161
|
+
</table>
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<!-- if method_list -->
|
171
|
+
<div id="methods">
|
172
|
+
<h3 class="section-bar">Public Class methods</h3>
|
173
|
+
|
174
|
+
<div id="method-M000010" class="method-detail">
|
175
|
+
<a name="M000010"></a>
|
176
|
+
|
177
|
+
<div class="method-heading">
|
178
|
+
<a href="#M000010" class="method-signature">
|
179
|
+
<span class="method-name">new</span><span class="method-args">(io)</span>
|
180
|
+
</a>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
<p>
|
185
|
+
Creates an SDL parser on the specified <tt>IO</tt>.
|
186
|
+
</p>
|
187
|
+
<pre>
|
188
|
+
IO.open("path/to/sdl_file") { |io|
|
189
|
+
parser = SDL4R::Parser.new(io)
|
190
|
+
tags = parser.parse()
|
191
|
+
}
|
192
|
+
</pre>
|
193
|
+
<p><a class="source-toggle" href="#"
|
194
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
195
|
+
<div class="method-source-code" id="M000010-source">
|
196
|
+
<pre>
|
197
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 56</span>
|
198
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">io</span>)
|
199
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"io == nil"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">nil?</span>
|
200
|
+
|
201
|
+
<span class="ruby-ivar">@tokenizer</span> = <span class="ruby-constant">Tokenizer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">io</span>)
|
202
|
+
<span class="ruby-keyword kw">end</span>
|
203
|
+
</pre>
|
204
|
+
</div>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
209
|
+
|
210
|
+
<div id="method-M000012" class="method-detail">
|
211
|
+
<a name="M000012"></a>
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<a href="#M000012" class="method-signature">
|
215
|
+
<span class="method-name">new_date_time</span><span class="method-args">(year, month, day, hour, min, sec, time_zone_offset)</span>
|
216
|
+
</a>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method-description">
|
220
|
+
<p>
|
221
|
+
Creates and returns the object representing a datetime (DateTime in the
|
222
|
+
default implementation). Can be overriden.
|
223
|
+
</p>
|
224
|
+
<pre>
|
225
|
+
def new_date_time(year, month, day, hour, min, sec, time_zone_offset)
|
226
|
+
Time.utc(year, month, day, hour, min, sec)
|
227
|
+
end
|
228
|
+
</pre>
|
229
|
+
<p><a class="source-toggle" href="#"
|
230
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
231
|
+
<div class="method-source-code" id="M000012-source">
|
232
|
+
<pre>
|
233
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 102</span>
|
234
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
|
235
|
+
<span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
|
236
|
+
<span class="ruby-keyword kw">end</span>
|
237
|
+
</pre>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div id="method-M000011" class="method-detail">
|
243
|
+
<a name="M000011"></a>
|
244
|
+
|
245
|
+
<div class="method-heading">
|
246
|
+
<a href="#M000011" class="method-signature">
|
247
|
+
<span class="method-name">parse</span><span class="method-args">()</span>
|
248
|
+
</a>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div class="method-description">
|
252
|
+
<p>
|
253
|
+
Parses the underlying <tt>IO</tt> and returns an <tt>Array</tt> of <tt><a
|
254
|
+
href="Tag.html">Tag</a></tt>.
|
255
|
+
</p>
|
256
|
+
<h2>Errors</h2>
|
257
|
+
<dl>
|
258
|
+
<dt>IOError</dt><dd>If a problem is encountered with the IO
|
259
|
+
|
260
|
+
</dd>
|
261
|
+
<dt><a href="SdlParseError.html">SdlParseError</a></dt><dd>If the document is malformed
|
262
|
+
|
263
|
+
</dd>
|
264
|
+
</dl>
|
265
|
+
<p><a class="source-toggle" href="#"
|
266
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
267
|
+
<div class="method-source-code" id="M000011-source">
|
268
|
+
<pre>
|
269
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 67</span>
|
270
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>
|
271
|
+
<span class="ruby-identifier">tags</span> = []
|
272
|
+
|
273
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">tokens</span> = <span class="ruby-ivar">@tokenizer</span>.<span class="ruby-identifier">read_line_tokens</span>()
|
274
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:START_BLOCK</span>
|
275
|
+
<span class="ruby-comment cmt"># tag with a block</span>
|
276
|
+
<span class="ruby-identifier">tag</span> = <span class="ruby-identifier">construct_tag</span>(<span class="ruby-identifier">tokens</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>])
|
277
|
+
<span class="ruby-identifier">add_children</span>(<span class="ruby-identifier">tag</span>)
|
278
|
+
<span class="ruby-identifier">tags</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tag</span>
|
279
|
+
|
280
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:END_BLOCK</span>
|
281
|
+
<span class="ruby-comment cmt"># we found an block end token that should have been consumed by</span>
|
282
|
+
<span class="ruby-comment cmt"># add_children() normally</span>
|
283
|
+
<span class="ruby-identifier">parse_error</span>(
|
284
|
+
<span class="ruby-value str">"No opening block ({) for close block (})."</span>,
|
285
|
+
<span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">line</span>,
|
286
|
+
<span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">position</span>)
|
287
|
+
<span class="ruby-keyword kw">else</span>
|
288
|
+
<span class="ruby-comment cmt"># tag without block</span>
|
289
|
+
<span class="ruby-identifier">tags</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">construct_tag</span>(<span class="ruby-identifier">tokens</span>)
|
290
|
+
<span class="ruby-keyword kw">end</span>
|
291
|
+
<span class="ruby-keyword kw">end</span>
|
292
|
+
|
293
|
+
<span class="ruby-ivar">@tokenizer</span>.<span class="ruby-identifier">close</span>()
|
294
|
+
|
295
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tags</span>
|
296
|
+
<span class="ruby-keyword kw">end</span>
|
297
|
+
</pre>
|
298
|
+
</div>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
|
306
|
+
</div>
|
307
|
+
|
308
|
+
|
309
|
+
<div id="validator-badges">
|
310
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
311
|
+
</div>
|
312
|
+
|
313
|
+
</body>
|
314
|
+
</html>
|
@@ -0,0 +1,303 @@
|
|
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: SDL4R::SdlBinary</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>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">SDL4R::SdlBinary</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/sdl4r/sdl_binary_rb.html">
|
59
|
+
lib/sdl4r/sdl_binary.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Represents a binary value.
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
This class was introduced to avoid the confusion between a Ruby String and
|
87
|
+
a binary literal.
|
88
|
+
</p>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div id="method-list">
|
96
|
+
<h3 class="section-bar">Methods</h3>
|
97
|
+
|
98
|
+
<div class="name-list">
|
99
|
+
<a href="#M000056">==</a>
|
100
|
+
<a href="#M000060">decode64</a>
|
101
|
+
<a href="#M000057">eql?</a>
|
102
|
+
<a href="#M000058">hash</a>
|
103
|
+
<a href="#M000055">new</a>
|
104
|
+
<a href="#M000059">to_s</a>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if includes -->
|
112
|
+
|
113
|
+
<div id="section">
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div id="attribute-list">
|
120
|
+
<h3 class="section-bar">Attributes</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<table>
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">bytes</td>
|
126
|
+
<td class="context-item-value"> [RW] </td>
|
127
|
+
<td class="context-item-desc"></td>
|
128
|
+
</tr>
|
129
|
+
</table>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<!-- if method_list -->
|
136
|
+
<div id="methods">
|
137
|
+
<h3 class="section-bar">Public Class methods</h3>
|
138
|
+
|
139
|
+
<div id="method-M000060" class="method-detail">
|
140
|
+
<a name="M000060"></a>
|
141
|
+
|
142
|
+
<div class="method-heading">
|
143
|
+
<a href="#M000060" class="method-signature">
|
144
|
+
<span class="method-name">decode64</span><span class="method-args">(s)</span>
|
145
|
+
</a>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="method-description">
|
149
|
+
<p>
|
150
|
+
Decodes the specified base-64 encoded string and returns a corresponding <a
|
151
|
+
href="SdlBinary.html">SdlBinary</a> instance. <tt>s</tt> might not include
|
152
|
+
the conventional starting and ending square brackets.
|
153
|
+
</p>
|
154
|
+
<p><a class="source-toggle" href="#"
|
155
|
+
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
156
|
+
<div class="method-source-code" id="M000060-source">
|
157
|
+
<pre>
|
158
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 54</span>
|
159
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">s</span>)
|
160
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"\n\r\t "</span>)
|
161
|
+
|
162
|
+
<span class="ruby-identifier">binary</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">s</span>)
|
163
|
+
|
164
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">binary</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">empty?</span>
|
165
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"bad binary literal"</span>
|
166
|
+
<span class="ruby-keyword kw">end</span>
|
167
|
+
|
168
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">SdlBinary</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">binary</span>)
|
169
|
+
<span class="ruby-keyword kw">end</span>
|
170
|
+
</pre>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div id="method-M000055" class="method-detail">
|
176
|
+
<a name="M000055"></a>
|
177
|
+
|
178
|
+
<div class="method-heading">
|
179
|
+
<a href="#M000055" class="method-signature">
|
180
|
+
<span class="method-name">new</span><span class="method-args">(bytes)</span>
|
181
|
+
</a>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div class="method-description">
|
185
|
+
<p>
|
186
|
+
<tt>value</tt>: a String containing the bytes
|
187
|
+
</p>
|
188
|
+
<p><a class="source-toggle" href="#"
|
189
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
190
|
+
<div class="method-source-code" id="M000055-source">
|
191
|
+
<pre>
|
192
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 30</span>
|
193
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bytes</span>)
|
194
|
+
<span class="ruby-ivar">@bytes</span> = <span class="ruby-identifier">bytes</span>
|
195
|
+
<span class="ruby-keyword kw">end</span>
|
196
|
+
</pre>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
202
|
+
|
203
|
+
<div id="method-M000056" class="method-detail">
|
204
|
+
<a name="M000056"></a>
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<a href="#M000056" class="method-signature">
|
208
|
+
<span class="method-name">==</span><span class="method-args">(o)</span>
|
209
|
+
</a>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
<div class="method-description">
|
213
|
+
<p><a class="source-toggle" href="#"
|
214
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
215
|
+
<div class="method-source-code" id="M000056-source">
|
216
|
+
<pre>
|
217
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 34</span>
|
218
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">o</span>)
|
219
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">o</span>)
|
220
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>)
|
221
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bytes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">o</span>.<span class="ruby-identifier">bytes</span>
|
222
|
+
<span class="ruby-keyword kw">end</span>
|
223
|
+
</pre>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
<div id="method-M000057" class="method-detail">
|
229
|
+
<a name="M000057"></a>
|
230
|
+
|
231
|
+
<div class="method-heading">
|
232
|
+
<span class="method-name">eql?</span><span class="method-args">(o)</span>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
<p>
|
237
|
+
Alias for #==
|
238
|
+
</p>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div id="method-M000058" class="method-detail">
|
243
|
+
<a name="M000058"></a>
|
244
|
+
|
245
|
+
<div class="method-heading">
|
246
|
+
<a href="#M000058" class="method-signature">
|
247
|
+
<span class="method-name">hash</span><span class="method-args">()</span>
|
248
|
+
</a>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div class="method-description">
|
252
|
+
<p><a class="source-toggle" href="#"
|
253
|
+
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
254
|
+
<div class="method-source-code" id="M000058-source">
|
255
|
+
<pre>
|
256
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 42</span>
|
257
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hash</span>
|
258
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">bytes</span>.<span class="ruby-identifier">hash</span>
|
259
|
+
<span class="ruby-keyword kw">end</span>
|
260
|
+
</pre>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div id="method-M000059" class="method-detail">
|
266
|
+
<a name="M000059"></a>
|
267
|
+
|
268
|
+
<div class="method-heading">
|
269
|
+
<a href="#M000059" class="method-signature">
|
270
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
271
|
+
</a>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div class="method-description">
|
275
|
+
<p>
|
276
|
+
Returns the bytes base64-encoded.
|
277
|
+
</p>
|
278
|
+
<p><a class="source-toggle" href="#"
|
279
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
280
|
+
<div class="method-source-code" id="M000059-source">
|
281
|
+
<pre>
|
282
|
+
<span class="ruby-comment cmt"># File lib/sdl4r/sdl_binary.rb, line 47</span>
|
283
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
284
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">bytes</span>)
|
285
|
+
<span class="ruby-keyword kw">end</span>
|
286
|
+
</pre>
|
287
|
+
</div>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
</div>
|
296
|
+
|
297
|
+
|
298
|
+
<div id="validator-badges">
|
299
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
</body>
|
303
|
+
</html>
|