binaryparse 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/binaryparse.gemspec +18 -0
- data/doc/classes/BinaryBlocker/BitFieldEncoder.html +328 -0
- data/doc/classes/BinaryBlocker/Blocker.html +168 -0
- data/doc/classes/BinaryBlocker/CountedArrayEncoder.html +347 -0
- data/doc/classes/BinaryBlocker/Encoder.html +526 -0
- data/doc/classes/BinaryBlocker/FixedArrayEncoder.html +278 -0
- data/doc/classes/BinaryBlocker/FixedStringEncoder.html +177 -0
- data/doc/classes/BinaryBlocker/FixedUTF16StringEncoder.html +229 -0
- data/doc/classes/BinaryBlocker/GroupEncoder.html +650 -0
- data/doc/classes/BinaryBlocker/ListOfEncoder.html +343 -0
- data/doc/classes/BinaryBlocker/OneOfEncoder.html +306 -0
- data/doc/classes/BinaryBlocker/PackedDateEncoder.html +220 -0
- data/doc/classes/BinaryBlocker/PackedDateTimeEncoder.html +220 -0
- data/doc/classes/BinaryBlocker/PackedNumberEncoder.html +231 -0
- data/doc/classes/BinaryBlocker/SimpleEncoder.html +284 -0
- data/doc/classes/BinaryBlocker.html +329 -0
- data/doc/classes/BufferedIO.html +324 -0
- data/doc/classes/TestBlocker/BBDate.html +120 -0
- data/doc/classes/TestBlocker/BBList.html +120 -0
- data/doc/classes/TestBlocker/BBPacked.html +120 -0
- data/doc/classes/TestBlocker/BBString.html +120 -0
- data/doc/classes/TestBlocker/BBSub1.html +120 -0
- data/doc/classes/TestBlocker/BBSub2.html +120 -0
- data/doc/classes/TestBlocker/BBTest1.html +120 -0
- data/doc/classes/TestBlocker/BBTest2.html +120 -0
- data/doc/classes/TestBlocker/BBTest3.html +120 -0
- data/doc/classes/TestBlocker/BBTest4.html +120 -0
- data/doc/classes/TestBlocker/BBTest5.html +120 -0
- data/doc/classes/TestBlocker/BBTest6.html +120 -0
- data/doc/classes/TestBlocker/BBTest7.html +120 -0
- data/doc/classes/TestBlocker/BBTime.html +120 -0
- data/doc/classes/TestBlocker/BBUTF16.html +120 -0
- data/doc/classes/TestBlocker/ItemA.html +120 -0
- data/doc/classes/TestBlocker/ItemB.html +120 -0
- data/doc/classes/TestBlocker.html +802 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +208 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +23 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_2.dot +32 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/m_0_0.dot +208 -0
- data/doc/dot/m_0_0.png +0 -0
- data/doc/files/lib/blocker_rb.html +144 -0
- data/doc/files/lib/buffered_io_rb.html +115 -0
- data/doc/files/test/test_blocker_rb.html +116 -0
- data/doc/fr_class_index.html +60 -0
- data/doc/fr_file_index.html +29 -0
- data/doc/fr_method_index.html +135 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/blocker.rb +736 -0
- data/lib/buffered_io.rb +58 -0
- data/test/test_blocker.rb +412 -0
- metadata +111 -0
@@ -0,0 +1,231 @@
|
|
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: BinaryBlocker::PackedNumberEncoder</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">BinaryBlocker::PackedNumberEncoder</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/blocker_rb.html">
|
59
|
+
lib/blocker.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
|
+
<a href="SimpleEncoder.html">
|
69
|
+
SimpleEncoder
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
<div id="diagram">
|
83
|
+
<map id="map" name="map">
|
84
|
+
<area shape="rect" coords="252,146,351,194" href="GroupEncoder.html" alt="GroupEncoder" />
|
85
|
+
<area shape="rect" coords="27,242,123,290" href="ListOfEncoder.html" alt="ListOfEncoder" />
|
86
|
+
<area shape="rect" coords="147,242,219,290" href="Blocker.html" alt="Blocker" />
|
87
|
+
<area shape="rect" coords="243,242,360,290" href="FixedArrayEncoder.html" alt="FixedArrayEncoder" />
|
88
|
+
<area shape="rect" coords="384,242,517,290" href="CountedArrayEncoder.html" alt="CountedArrayEncoder" />
|
89
|
+
<area shape="rect" coords="683,50,755,98" href="Encoder.html" alt="Encoder" />
|
90
|
+
<area shape="rect" coords="605,146,707,194" href="SimpleEncoder.html" alt="SimpleEncoder" />
|
91
|
+
<area shape="rect" coords="731,146,835,194" href="BitFieldEncoder.html" alt="BitFieldEncoder" />
|
92
|
+
<area shape="rect" coords="859,146,960,194" href="OneOfEncoder.html" alt="OneOfEncoder" />
|
93
|
+
<area shape="rect" coords="541,242,683,290" href="PackedNumberEncoder.html" alt="PackedNumberEncoder" />
|
94
|
+
<area shape="rect" coords="469,338,595,386" href="PackedDateEncoder.html" alt="PackedDateEncoder" />
|
95
|
+
<area shape="rect" coords="619,338,765,386" href="PackedDateTimeEncoder.html" alt="PackedDateTimeEncoder" />
|
96
|
+
<area shape="rect" coords="707,242,827,290" href="FixedStringEncoder.html" alt="FixedStringEncoder" />
|
97
|
+
<area shape="rect" coords="851,242,1005,290" href="FixedUTF16StringEncoder.html" alt="FixedUTF16StringEncoder" />
|
98
|
+
<area shape="rect" coords="16,16,1016,396" href="../BinaryBlocker.html" alt="BinaryBlocker" />
|
99
|
+
</map>
|
100
|
+
<img src="../../dot/m_0_0.png" usemap="#map" border="0" alt="Module: BinaryBlocker" />
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div id="method-list">
|
108
|
+
<h3 class="section-bar">Methods</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<a href="#M000065">internal_block</a>
|
112
|
+
<a href="#M000066">internal_deblock</a>
|
113
|
+
<a href="#M000064">new</a>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
<!-- if includes -->
|
121
|
+
|
122
|
+
<div id="section">
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<!-- if method_list -->
|
132
|
+
<div id="methods">
|
133
|
+
<h3 class="section-bar">Public Class methods</h3>
|
134
|
+
|
135
|
+
<div id="method-M000064" class="method-detail">
|
136
|
+
<a name="M000064"></a>
|
137
|
+
|
138
|
+
<div class="method-heading">
|
139
|
+
<a href="#M000064" class="method-signature">
|
140
|
+
<span class="method-name">new</span><span class="method-args">(*opts)</span>
|
141
|
+
</a>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="method-description">
|
145
|
+
<p><a class="source-toggle" href="#"
|
146
|
+
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
147
|
+
<div class="method-source-code" id="M000064-source">
|
148
|
+
<pre>
|
149
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 426</span>
|
150
|
+
426: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
151
|
+
427: <span class="ruby-identifier">initialize_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
152
|
+
428:
|
153
|
+
429: <span class="ruby-ivar">@length</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-identifier">:length</span>].<span class="ruby-identifier">to_i</span>
|
154
|
+
430: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"Missing or invalid string length"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
155
|
+
431: <span class="ruby-ivar">@length</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@length</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
156
|
+
432: <span class="ruby-ivar">@bytes</span> = <span class="ruby-ivar">@length</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>
|
157
|
+
433: <span class="ruby-ivar">@format</span> = <span class="ruby-node">"H#{@length}"</span>
|
158
|
+
434:
|
159
|
+
435: <span class="ruby-ivar">@key</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-identifier">:key</span>]
|
160
|
+
436: <span class="ruby-ivar">@valid</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-identifier">:valid</span>]
|
161
|
+
437:
|
162
|
+
438: <span class="ruby-identifier">initialize_data</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
163
|
+
439: <span class="ruby-keyword kw">end</span>
|
164
|
+
</pre>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
170
|
+
|
171
|
+
<div id="method-M000065" class="method-detail">
|
172
|
+
<a name="M000065"></a>
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<a href="#M000065" class="method-signature">
|
176
|
+
<span class="method-name">internal_block</span><span class="method-args">(val)</span>
|
177
|
+
</a>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
<p><a class="source-toggle" href="#"
|
182
|
+
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
183
|
+
<div class="method-source-code" id="M000065-source">
|
184
|
+
<pre>
|
185
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 441</span>
|
186
|
+
441: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_block</span>(<span class="ruby-identifier">val</span>)
|
187
|
+
442: [<span class="ruby-node">"%0#{@length}d"</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">val</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-ivar">@format</span>)
|
188
|
+
443: <span class="ruby-keyword kw">end</span>
|
189
|
+
</pre>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div id="method-M000066" class="method-detail">
|
195
|
+
<a name="M000066"></a>
|
196
|
+
|
197
|
+
<div class="method-heading">
|
198
|
+
<a href="#M000066" class="method-signature">
|
199
|
+
<span class="method-name">internal_deblock</span><span class="method-args">(io)</span>
|
200
|
+
</a>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class="method-description">
|
204
|
+
<p><a class="source-toggle" href="#"
|
205
|
+
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
206
|
+
<div class="method-source-code" id="M000066-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 445</span>
|
209
|
+
445: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_deblock</span>(<span class="ruby-identifier">io</span>)
|
210
|
+
446: <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@bytes</span>)
|
211
|
+
447: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-ivar">@format</span>)
|
212
|
+
448: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_i</span>
|
213
|
+
449: <span class="ruby-keyword kw">end</span>
|
214
|
+
</pre>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
|
220
|
+
</div>
|
221
|
+
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
<div id="validator-badges">
|
227
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
</body>
|
231
|
+
</html>
|
@@ -0,0 +1,284 @@
|
|
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: BinaryBlocker::SimpleEncoder</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">BinaryBlocker::SimpleEncoder</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/blocker_rb.html">
|
59
|
+
lib/blocker.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
|
+
<a href="Encoder.html">
|
69
|
+
Encoder
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
<div id="diagram">
|
83
|
+
<map id="map" name="map">
|
84
|
+
<area shape="rect" coords="252,146,351,194" href="GroupEncoder.html" alt="GroupEncoder" />
|
85
|
+
<area shape="rect" coords="27,242,123,290" href="ListOfEncoder.html" alt="ListOfEncoder" />
|
86
|
+
<area shape="rect" coords="147,242,219,290" href="Blocker.html" alt="Blocker" />
|
87
|
+
<area shape="rect" coords="243,242,360,290" href="FixedArrayEncoder.html" alt="FixedArrayEncoder" />
|
88
|
+
<area shape="rect" coords="384,242,517,290" href="CountedArrayEncoder.html" alt="CountedArrayEncoder" />
|
89
|
+
<area shape="rect" coords="683,50,755,98" href="Encoder.html" alt="Encoder" />
|
90
|
+
<area shape="rect" coords="605,146,707,194" href="SimpleEncoder.html" alt="SimpleEncoder" />
|
91
|
+
<area shape="rect" coords="731,146,835,194" href="BitFieldEncoder.html" alt="BitFieldEncoder" />
|
92
|
+
<area shape="rect" coords="859,146,960,194" href="OneOfEncoder.html" alt="OneOfEncoder" />
|
93
|
+
<area shape="rect" coords="541,242,683,290" href="PackedNumberEncoder.html" alt="PackedNumberEncoder" />
|
94
|
+
<area shape="rect" coords="469,338,595,386" href="PackedDateEncoder.html" alt="PackedDateEncoder" />
|
95
|
+
<area shape="rect" coords="619,338,765,386" href="PackedDateTimeEncoder.html" alt="PackedDateTimeEncoder" />
|
96
|
+
<area shape="rect" coords="707,242,827,290" href="FixedStringEncoder.html" alt="FixedStringEncoder" />
|
97
|
+
<area shape="rect" coords="851,242,1005,290" href="FixedUTF16StringEncoder.html" alt="FixedUTF16StringEncoder" />
|
98
|
+
<area shape="rect" coords="16,16,1016,396" href="../BinaryBlocker.html" alt="BinaryBlocker" />
|
99
|
+
</map>
|
100
|
+
<img src="../../dot/m_0_0.png" usemap="#map" border="0" alt="Module: BinaryBlocker" />
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div id="method-list">
|
108
|
+
<h3 class="section-bar">Methods</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<a href="#M000098">inspect</a>
|
112
|
+
<a href="#M000095">internal_block</a>
|
113
|
+
<a href="#M000096">internal_deblock</a>
|
114
|
+
<a href="#M000094">register</a>
|
115
|
+
<a href="#M000097">valid?</a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
<!-- if includes -->
|
123
|
+
|
124
|
+
<div id="section">
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- if method_list -->
|
134
|
+
<div id="methods">
|
135
|
+
<h3 class="section-bar">Public Class methods</h3>
|
136
|
+
|
137
|
+
<div id="method-M000094" class="method-detail">
|
138
|
+
<a name="M000094"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="#M000094" class="method-signature">
|
142
|
+
<span class="method-name">register</span><span class="method-args">(sym, fmt, *opts)</span>
|
143
|
+
</a>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
<p><a class="source-toggle" href="#"
|
148
|
+
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
|
149
|
+
<div class="method-source-code" id="M000094-source">
|
150
|
+
<pre>
|
151
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 334</span>
|
152
|
+
334: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">register</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">fmt</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
153
|
+
335: <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">SimpleEncoder</span>)
|
154
|
+
336: <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:define_method</span>,<span class="ruby-identifier">:initialize</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
|
155
|
+
337: <span class="ruby-identifier">initialize_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
156
|
+
338:
|
157
|
+
339: <span class="ruby-ivar">@format</span> = <span class="ruby-identifier">fmt</span>
|
158
|
+
340: <span class="ruby-ivar">@length</span> = <span class="ruby-constant">BinaryBlocker</span>.<span class="ruby-identifier">sizeof_format</span>(<span class="ruby-ivar">@format</span>)
|
159
|
+
341:
|
160
|
+
342: <span class="ruby-ivar">@key</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-identifier">:key</span>]
|
161
|
+
343: <span class="ruby-ivar">@valid</span> = <span class="ruby-ivar">@opts</span>[<span class="ruby-identifier">:valid</span>]
|
162
|
+
344:
|
163
|
+
345: <span class="ruby-identifier">initialize_data</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
164
|
+
346: <span class="ruby-keyword kw">end</span>
|
165
|
+
347: <span class="ruby-constant">BinaryBlocker</span>.<span class="ruby-identifier">register_klass</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">klass</span>)
|
166
|
+
348: <span class="ruby-keyword kw">end</span>
|
167
|
+
</pre>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
173
|
+
|
174
|
+
<div id="method-M000098" class="method-detail">
|
175
|
+
<a name="M000098"></a>
|
176
|
+
|
177
|
+
<div class="method-heading">
|
178
|
+
<a href="#M000098" class="method-signature">
|
179
|
+
<span class="method-name">inspect</span><span class="method-args">()</span>
|
180
|
+
</a>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
<p><a class="source-toggle" href="#"
|
185
|
+
onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
|
186
|
+
<div class="method-source-code" id="M000098-source">
|
187
|
+
<pre>
|
188
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 368</span>
|
189
|
+
368: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
190
|
+
369: <span class="ruby-node">"SE: #{self.class} - #{@format} - #{@length} - #{self.value.inspect}"</span>
|
191
|
+
370: <span class="ruby-keyword kw">end</span>
|
192
|
+
</pre>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div id="method-M000095" class="method-detail">
|
198
|
+
<a name="M000095"></a>
|
199
|
+
|
200
|
+
<div class="method-heading">
|
201
|
+
<a href="#M000095" class="method-signature">
|
202
|
+
<span class="method-name">internal_block</span><span class="method-args">(val)</span>
|
203
|
+
</a>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div class="method-description">
|
207
|
+
<p><a class="source-toggle" href="#"
|
208
|
+
onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
|
209
|
+
<div class="method-source-code" id="M000095-source">
|
210
|
+
<pre>
|
211
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 350</span>
|
212
|
+
350: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_block</span>(<span class="ruby-identifier">val</span>)
|
213
|
+
351: [<span class="ruby-identifier">val</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-ivar">@format</span>)
|
214
|
+
352: <span class="ruby-keyword kw">end</span>
|
215
|
+
</pre>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<div id="method-M000096" class="method-detail">
|
221
|
+
<a name="M000096"></a>
|
222
|
+
|
223
|
+
<div class="method-heading">
|
224
|
+
<a href="#M000096" class="method-signature">
|
225
|
+
<span class="method-name">internal_deblock</span><span class="method-args">(io)</span>
|
226
|
+
</a>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
<div class="method-description">
|
230
|
+
<p><a class="source-toggle" href="#"
|
231
|
+
onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
|
232
|
+
<div class="method-source-code" id="M000096-source">
|
233
|
+
<pre>
|
234
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 354</span>
|
235
|
+
354: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_deblock</span>(<span class="ruby-identifier">io</span>)
|
236
|
+
355: <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@length</span>)
|
237
|
+
356: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-ivar">@format</span>)
|
238
|
+
357: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>
|
239
|
+
358: <span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div id="method-M000097" class="method-detail">
|
246
|
+
<a name="M000097"></a>
|
247
|
+
|
248
|
+
<div class="method-heading">
|
249
|
+
<a href="#M000097" class="method-signature">
|
250
|
+
<span class="method-name">valid?</span><span class="method-args">()</span>
|
251
|
+
</a>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
<div class="method-description">
|
255
|
+
<p><a class="source-toggle" href="#"
|
256
|
+
onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
|
257
|
+
<div class="method-source-code" id="M000097-source">
|
258
|
+
<pre>
|
259
|
+
<span class="ruby-comment cmt"># File lib/blocker.rb, line 360</span>
|
260
|
+
360: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid?</span>
|
261
|
+
361: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@valid</span>
|
262
|
+
362: <span class="ruby-ivar">@valid</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">value</span>)
|
263
|
+
363: <span class="ruby-keyword kw">else</span>
|
264
|
+
364: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">value</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&&</span> (<span class="ruby-ivar">@key</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@key</span> <span class="ruby-operator">===</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">value</span>)
|
265
|
+
365: <span class="ruby-keyword kw">end</span>
|
266
|
+
366: <span class="ruby-keyword kw">end</span>
|
267
|
+
</pre>
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
</div>
|
277
|
+
|
278
|
+
|
279
|
+
<div id="validator-badges">
|
280
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
</body>
|
284
|
+
</html>
|