binaryparse 0.1.2 → 0.1.3
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/binaryparse.gemspec +17 -17
- data/examples/pms_input_2_test.rb +70 -0
- data/lib/blocker.rb +1 -1
- metadata +3 -66
- data/doc/binaryparse.chm +0 -0
- data/doc/bphelp.zip +0 -0
- data/doc/classes/BinaryBlocker/BitFieldEncoder.html +0 -328
- data/doc/classes/BinaryBlocker/Blocker.html +0 -168
- data/doc/classes/BinaryBlocker/CountedArrayEncoder.html +0 -347
- data/doc/classes/BinaryBlocker/Encoder.html +0 -526
- data/doc/classes/BinaryBlocker/FixedArrayEncoder.html +0 -278
- data/doc/classes/BinaryBlocker/FixedStringEncoder.html +0 -177
- data/doc/classes/BinaryBlocker/FixedUTF16StringEncoder.html +0 -229
- data/doc/classes/BinaryBlocker/GroupEncoder.html +0 -650
- data/doc/classes/BinaryBlocker/ListOfEncoder.html +0 -343
- data/doc/classes/BinaryBlocker/OneOfEncoder.html +0 -306
- data/doc/classes/BinaryBlocker/PackedDateEncoder.html +0 -220
- data/doc/classes/BinaryBlocker/PackedDateTimeEncoder.html +0 -220
- data/doc/classes/BinaryBlocker/PackedNumberEncoder.html +0 -231
- data/doc/classes/BinaryBlocker/SimpleEncoder.html +0 -284
- data/doc/classes/BinaryBlocker.html +0 -329
- data/doc/classes/BufferedIO.html +0 -324
- data/doc/classes/TestBlocker/BBDate.html +0 -120
- data/doc/classes/TestBlocker/BBList.html +0 -120
- data/doc/classes/TestBlocker/BBPacked.html +0 -120
- data/doc/classes/TestBlocker/BBString.html +0 -120
- data/doc/classes/TestBlocker/BBSub1.html +0 -120
- data/doc/classes/TestBlocker/BBSub2.html +0 -120
- data/doc/classes/TestBlocker/BBTest1.html +0 -120
- data/doc/classes/TestBlocker/BBTest2.html +0 -120
- data/doc/classes/TestBlocker/BBTest3.html +0 -120
- data/doc/classes/TestBlocker/BBTest4.html +0 -120
- data/doc/classes/TestBlocker/BBTest5.html +0 -120
- data/doc/classes/TestBlocker/BBTest6.html +0 -120
- data/doc/classes/TestBlocker/BBTest7.html +0 -120
- data/doc/classes/TestBlocker/BBTime.html +0 -120
- data/doc/classes/TestBlocker/BBUTF16.html +0 -120
- data/doc/classes/TestBlocker/ItemA.html +0 -120
- data/doc/classes/TestBlocker/ItemB.html +0 -120
- data/doc/classes/TestBlocker.html +0 -802
- data/doc/contents.hhc +0 -670
- data/doc/created.rid +0 -1
- data/doc/dot/f_0.dot +0 -208
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +0 -23
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_2.dot +0 -32
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/m_0_0.dot +0 -208
- data/doc/dot/m_0_0.png +0 -0
- data/doc/files/lib/blocker_rb.html +0 -144
- data/doc/files/lib/buffered_io_rb.html +0 -115
- data/doc/files/test/test_blocker_rb.html +0 -116
- data/doc/fr_class_index.html +0 -60
- data/doc/fr_file_index.html +0 -29
- data/doc/fr_method_index.html +0 -135
- data/doc/index.hhk +0 -599
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/doc/rdoc.hhp +0 -15
data/binaryparse.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
spec = Gem::Specification.new do |s|
|
4
|
-
s.name = "binaryparse"
|
5
|
-
s.version = "0.1.
|
6
|
-
s.author = "Patrick Hurley"
|
7
|
-
s.email = "phurley@gmail.com"
|
8
|
-
s.homepage = "http://binaryparse.rubyforge.org/"
|
9
|
-
s.platform = Gem::Platform::RUBY
|
10
|
-
s.summary = "Binaryparse is a simple Ruby DSL to parse semi-complicated binary structures. This includes structures dynamic in length, which cannot be handled by DL::Struct or BitStructEx."
|
11
|
-
s.files = Dir["**/*"]
|
12
|
-
s.autorequire = "binaryparse"
|
13
|
-
end
|
14
|
-
|
15
|
-
if __FILE__ == $PROGRAM_NAME
|
16
|
-
Gem::manage_gems
|
17
|
-
Gem::Builder.new(spec).build
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = "binaryparse"
|
5
|
+
s.version = "0.1.3"
|
6
|
+
s.author = "Patrick Hurley"
|
7
|
+
s.email = "phurley@gmail.com"
|
8
|
+
s.homepage = "http://binaryparse.rubyforge.org/"
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = "Binaryparse is a simple Ruby DSL to parse semi-complicated binary structures. This includes structures dynamic in length, which cannot be handled by DL::Struct or BitStructEx."
|
11
|
+
s.files = Dir["**/*"]
|
12
|
+
s.autorequire = "binaryparse"
|
13
|
+
end
|
14
|
+
|
15
|
+
if __FILE__ == $PROGRAM_NAME
|
16
|
+
Gem::manage_gems
|
17
|
+
Gem::Builder.new(spec).build
|
18
18
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
require 'blocker'
|
4
|
+
require 'stringio'
|
5
|
+
|
6
|
+
class PMS_UserArea < BinaryBlocker::Blocker
|
7
|
+
has_one :filler, :uint8
|
8
|
+
end
|
9
|
+
|
10
|
+
class PMS_ItemMaintenance < BinaryBlocker::Blocker
|
11
|
+
has_one :record_code, :int8, :key=> 0x13
|
12
|
+
has_one :sku, :string, :length => 8
|
13
|
+
has_one :update_code, :int16
|
14
|
+
has_one :dept, :packed, :length => 6
|
15
|
+
has_one :classs, :packed, :length => 6
|
16
|
+
has_one :retail_price, :packed, :length => 12
|
17
|
+
has_one :secondary_price, :packed, :length => 12
|
18
|
+
has_one :lowest_price, :packed, :length => 12
|
19
|
+
has_one :lowest_price_date, :date
|
20
|
+
has_one :item_status_flag, :uint16
|
21
|
+
has_one :description, :utf16, :length => 40
|
22
|
+
has_fixed_array :user_area, 13, [PMS_UserArea]
|
23
|
+
end
|
24
|
+
|
25
|
+
class PmsInputTest < Test::Unit::TestCase
|
26
|
+
|
27
|
+
def write_the_block(fobj,obj)
|
28
|
+
fobj.write(obj.block)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_create_item
|
32
|
+
|
33
|
+
item = PMS_ItemMaintenance.new
|
34
|
+
item.record_code = 0x13
|
35
|
+
item.sku = "50000001"
|
36
|
+
item.update_code = 0
|
37
|
+
item.dept = 300
|
38
|
+
item.classs = 20
|
39
|
+
item.retail_price = 599
|
40
|
+
item.secondary_price = 499
|
41
|
+
item.lowest_price = 399
|
42
|
+
item.lowest_price_date = Date.new(2006,05,13)
|
43
|
+
item.item_status_flag = 0
|
44
|
+
item.description = "I made this up!"
|
45
|
+
(0..12).each {|i|
|
46
|
+
item.user_area[i] = PMS_UserArea.new
|
47
|
+
item.user_area[i].filler = i
|
48
|
+
}
|
49
|
+
|
50
|
+
filename = "testitem"
|
51
|
+
File.delete(filename) if File.exist?(filename)
|
52
|
+
f = File.new(filename, "wb+")
|
53
|
+
(0..5).each do |i|
|
54
|
+
item.sku = (50000000 + i).to_s
|
55
|
+
write_the_block(f,item)
|
56
|
+
end
|
57
|
+
f.close
|
58
|
+
|
59
|
+
|
60
|
+
File.open(filename, "rb") do |fhndl|
|
61
|
+
until fhndl.eof?
|
62
|
+
start = fhndl.pos
|
63
|
+
rec = PMS_ItemMaintenance.new(fhndl)
|
64
|
+
puts "#{rec.class}: #{start}-#{fhndl.pos}"
|
65
|
+
p rec.sku + " " + rec.description
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/lib/blocker.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: binaryparse
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.1.3
|
7
|
+
date: 2006-09-06 00:00:00 -04:00
|
8
8
|
summary: Binaryparse is a simple Ruby DSL to parse semi-complicated binary structures. This includes structures dynamic in length, which cannot be handled by DL::Struct or BitStructEx.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,74 +30,11 @@ authors:
|
|
30
30
|
- Patrick Hurley
|
31
31
|
files:
|
32
32
|
- binaryparse.gemspec
|
33
|
-
- doc
|
34
33
|
- examples
|
35
34
|
- lib
|
36
35
|
- test
|
37
|
-
- doc/binaryparse.chm
|
38
|
-
- doc/bphelp.zip
|
39
|
-
- doc/classes
|
40
|
-
- doc/contents.hhc
|
41
|
-
- doc/created.rid
|
42
|
-
- doc/dot
|
43
|
-
- doc/files
|
44
|
-
- doc/fr_class_index.html
|
45
|
-
- doc/fr_file_index.html
|
46
|
-
- doc/fr_method_index.html
|
47
|
-
- doc/index.hhk
|
48
|
-
- doc/index.html
|
49
|
-
- doc/rdoc-style.css
|
50
|
-
- doc/rdoc.hhp
|
51
|
-
- doc/classes/BinaryBlocker
|
52
|
-
- doc/classes/BinaryBlocker.html
|
53
|
-
- doc/classes/BufferedIO.html
|
54
|
-
- doc/classes/TestBlocker
|
55
|
-
- doc/classes/TestBlocker.html
|
56
|
-
- doc/classes/BinaryBlocker/BitFieldEncoder.html
|
57
|
-
- doc/classes/BinaryBlocker/Blocker.html
|
58
|
-
- doc/classes/BinaryBlocker/CountedArrayEncoder.html
|
59
|
-
- doc/classes/BinaryBlocker/Encoder.html
|
60
|
-
- doc/classes/BinaryBlocker/FixedArrayEncoder.html
|
61
|
-
- doc/classes/BinaryBlocker/FixedStringEncoder.html
|
62
|
-
- doc/classes/BinaryBlocker/FixedUTF16StringEncoder.html
|
63
|
-
- doc/classes/BinaryBlocker/GroupEncoder.html
|
64
|
-
- doc/classes/BinaryBlocker/ListOfEncoder.html
|
65
|
-
- doc/classes/BinaryBlocker/OneOfEncoder.html
|
66
|
-
- doc/classes/BinaryBlocker/PackedDateEncoder.html
|
67
|
-
- doc/classes/BinaryBlocker/PackedDateTimeEncoder.html
|
68
|
-
- doc/classes/BinaryBlocker/PackedNumberEncoder.html
|
69
|
-
- doc/classes/BinaryBlocker/SimpleEncoder.html
|
70
|
-
- doc/classes/TestBlocker/BBDate.html
|
71
|
-
- doc/classes/TestBlocker/BBList.html
|
72
|
-
- doc/classes/TestBlocker/BBPacked.html
|
73
|
-
- doc/classes/TestBlocker/BBString.html
|
74
|
-
- doc/classes/TestBlocker/BBSub1.html
|
75
|
-
- doc/classes/TestBlocker/BBSub2.html
|
76
|
-
- doc/classes/TestBlocker/BBTest1.html
|
77
|
-
- doc/classes/TestBlocker/BBTest2.html
|
78
|
-
- doc/classes/TestBlocker/BBTest3.html
|
79
|
-
- doc/classes/TestBlocker/BBTest4.html
|
80
|
-
- doc/classes/TestBlocker/BBTest5.html
|
81
|
-
- doc/classes/TestBlocker/BBTest6.html
|
82
|
-
- doc/classes/TestBlocker/BBTest7.html
|
83
|
-
- doc/classes/TestBlocker/BBTime.html
|
84
|
-
- doc/classes/TestBlocker/BBUTF16.html
|
85
|
-
- doc/classes/TestBlocker/ItemA.html
|
86
|
-
- doc/classes/TestBlocker/ItemB.html
|
87
|
-
- doc/dot/f_0.dot
|
88
|
-
- doc/dot/f_0.png
|
89
|
-
- doc/dot/f_1.dot
|
90
|
-
- doc/dot/f_1.png
|
91
|
-
- doc/dot/f_2.dot
|
92
|
-
- doc/dot/f_2.png
|
93
|
-
- doc/dot/m_0_0.dot
|
94
|
-
- doc/dot/m_0_0.png
|
95
|
-
- doc/files/lib
|
96
|
-
- doc/files/test
|
97
|
-
- doc/files/lib/blocker_rb.html
|
98
|
-
- doc/files/lib/buffered_io_rb.html
|
99
|
-
- doc/files/test/test_blocker_rb.html
|
100
36
|
- examples/cmasqls.rb
|
37
|
+
- examples/pms_input_2_test.rb
|
101
38
|
- examples/readme.txt
|
102
39
|
- lib/blocker.rb
|
103
40
|
- lib/buffered_io.rb
|
data/doc/binaryparse.chm
DELETED
Binary file
|
data/doc/bphelp.zip
DELETED
Binary file
|
@@ -1,328 +0,0 @@
|
|
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::BitFieldEncoder</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::BitFieldEncoder</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="#M000069">internal_block</a>
|
112
|
-
<a href="#M000070">internal_deblock</a>
|
113
|
-
<a href="#M000073">method_missing</a>
|
114
|
-
<a href="#M000068">new</a>
|
115
|
-
<a href="#M000072">raw_value</a>
|
116
|
-
<a href="#M000071">value</a>
|
117
|
-
</div>
|
118
|
-
</div>
|
119
|
-
|
120
|
-
</div>
|
121
|
-
|
122
|
-
|
123
|
-
<!-- if includes -->
|
124
|
-
|
125
|
-
<div id="section">
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<!-- if method_list -->
|
135
|
-
<div id="methods">
|
136
|
-
<h3 class="section-bar">Public Class methods</h3>
|
137
|
-
|
138
|
-
<div id="method-M000068" class="method-detail">
|
139
|
-
<a name="M000068"></a>
|
140
|
-
|
141
|
-
<div class="method-heading">
|
142
|
-
<a href="#M000068" class="method-signature">
|
143
|
-
<span class="method-name">new</span><span class="method-args">(type, bit_info, *opts)</span>
|
144
|
-
</a>
|
145
|
-
</div>
|
146
|
-
|
147
|
-
<div class="method-description">
|
148
|
-
<p><a class="source-toggle" href="#"
|
149
|
-
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
|
150
|
-
<div class="method-source-code" id="M000068-source">
|
151
|
-
<pre>
|
152
|
-
<span class="ruby-comment cmt"># File lib/blocker.rb, line 666</span>
|
153
|
-
666: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">bit_info</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
154
|
-
667: <span class="ruby-ivar">@type</span> = <span class="ruby-constant">BinaryBlocker</span>.<span class="ruby-identifier">pack_symbols</span>[<span class="ruby-identifier">type</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">type</span>
|
155
|
-
668: <span class="ruby-ivar">@length</span> = <span class="ruby-constant">BinaryBlocker</span>.<span class="ruby-identifier">sizeof_format</span>(<span class="ruby-ivar">@type</span>)
|
156
|
-
669: <span class="ruby-ivar">@bit_info</span> = {}
|
157
|
-
670: <span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
158
|
-
671: <span class="ruby-identifier">bit_info</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">bi</span><span class="ruby-operator">|</span>
|
159
|
-
672: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">bi</span>
|
160
|
-
673: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Symbol</span>
|
161
|
-
674: <span class="ruby-ivar">@bit_info</span>[<span class="ruby-identifier">bi</span>.<span class="ruby-identifier">to_sym</span>] = [<span class="ruby-identifier">pos</span>,<span class="ruby-value">1</span>]
|
162
|
-
675: <span class="ruby-identifier">pos</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
163
|
-
676:
|
164
|
-
677: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Fixnum</span>
|
165
|
-
678: <span class="ruby-identifier">pos</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">bi</span>
|
166
|
-
679:
|
167
|
-
680: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Array</span>
|
168
|
-
681: <span class="ruby-ivar">@bit_info</span>[<span class="ruby-identifier">bi</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_sym</span>] = [<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_i</span>]
|
169
|
-
682: <span class="ruby-identifier">pos</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">to_i</span>
|
170
|
-
683: <span class="ruby-keyword kw">end</span>
|
171
|
-
684: <span class="ruby-keyword kw">end</span>
|
172
|
-
685: <span class="ruby-ivar">@value</span> = <span class="ruby-value">0</span>
|
173
|
-
686: <span class="ruby-identifier">initialize_options</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
174
|
-
687: <span class="ruby-identifier">initialize_data</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">opts</span>)
|
175
|
-
688: <span class="ruby-keyword kw">end</span>
|
176
|
-
</pre>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
</div>
|
180
|
-
|
181
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
182
|
-
|
183
|
-
<div id="method-M000069" class="method-detail">
|
184
|
-
<a name="M000069"></a>
|
185
|
-
|
186
|
-
<div class="method-heading">
|
187
|
-
<a href="#M000069" class="method-signature">
|
188
|
-
<span class="method-name">internal_block</span><span class="method-args">(val)</span>
|
189
|
-
</a>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div class="method-description">
|
193
|
-
<p><a class="source-toggle" href="#"
|
194
|
-
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
|
195
|
-
<div class="method-source-code" id="M000069-source">
|
196
|
-
<pre>
|
197
|
-
<span class="ruby-comment cmt"># File lib/blocker.rb, line 690</span>
|
198
|
-
690: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_block</span>(<span class="ruby-identifier">val</span>)
|
199
|
-
691: [<span class="ruby-identifier">val</span>.<span class="ruby-identifier">raw_value</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-ivar">@type</span>)
|
200
|
-
692: <span class="ruby-keyword kw">end</span>
|
201
|
-
</pre>
|
202
|
-
</div>
|
203
|
-
</div>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
<div id="method-M000070" class="method-detail">
|
207
|
-
<a name="M000070"></a>
|
208
|
-
|
209
|
-
<div class="method-heading">
|
210
|
-
<a href="#M000070" class="method-signature">
|
211
|
-
<span class="method-name">internal_deblock</span><span class="method-args">(io)</span>
|
212
|
-
</a>
|
213
|
-
</div>
|
214
|
-
|
215
|
-
<div class="method-description">
|
216
|
-
<p><a class="source-toggle" href="#"
|
217
|
-
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
|
218
|
-
<div class="method-source-code" id="M000070-source">
|
219
|
-
<pre>
|
220
|
-
<span class="ruby-comment cmt"># File lib/blocker.rb, line 694</span>
|
221
|
-
694: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_deblock</span>(<span class="ruby-identifier">io</span>)
|
222
|
-
695: <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">io</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@length</span>)
|
223
|
-
696: <span class="ruby-identifier">result</span> = <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-ivar">@type</span>)
|
224
|
-
697: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">first</span>
|
225
|
-
698: <span class="ruby-keyword kw">end</span>
|
226
|
-
</pre>
|
227
|
-
</div>
|
228
|
-
</div>
|
229
|
-
</div>
|
230
|
-
|
231
|
-
<div id="method-M000073" class="method-detail">
|
232
|
-
<a name="M000073"></a>
|
233
|
-
|
234
|
-
<div class="method-heading">
|
235
|
-
<a href="#M000073" class="method-signature">
|
236
|
-
<span class="method-name">method_missing</span><span class="method-args">(sym, *args)</span>
|
237
|
-
</a>
|
238
|
-
</div>
|
239
|
-
|
240
|
-
<div class="method-description">
|
241
|
-
<p><a class="source-toggle" href="#"
|
242
|
-
onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
|
243
|
-
<div class="method-source-code" id="M000073-source">
|
244
|
-
<pre>
|
245
|
-
<span class="ruby-comment cmt"># File lib/blocker.rb, line 708</span>
|
246
|
-
708: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
247
|
-
709: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">bi</span> = <span class="ruby-ivar">@bit_info</span>[<span class="ruby-identifier">sym</span>])
|
248
|
-
710: <span class="ruby-identifier">v</span> = <span class="ruby-ivar">@value</span> <span class="ruby-operator">>></span> <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">first</span>
|
249
|
-
711: <span class="ruby-identifier">mask</span> = (<span class="ruby-value">1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">last</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
250
|
-
712: <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span> <span class="ruby-operator">&</span> <span class="ruby-identifier">mask</span>
|
251
|
-
713: <span class="ruby-keyword kw">else</span>
|
252
|
-
714: <span class="ruby-identifier">sym</span> = <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">to_s</span>
|
253
|
-
715: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sym</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?=</span>
|
254
|
-
716: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bi</span> = <span class="ruby-ivar">@bit_info</span>[<span class="ruby-identifier">sym</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">to_sym</span>]
|
255
|
-
717: <span class="ruby-ivar">@value</span> <span class="ruby-operator">&=</span> <span class="ruby-operator">~</span>(((<span class="ruby-value">1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">last</span>) <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator"><<</span> <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">first</span>)
|
256
|
-
718: <span class="ruby-ivar">@value</span> <span class="ruby-operator">|=</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">bi</span>.<span class="ruby-identifier">first</span>
|
257
|
-
719: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@value</span>
|
258
|
-
720: <span class="ruby-keyword kw">end</span>
|
259
|
-
721: <span class="ruby-keyword kw">end</span>
|
260
|
-
722: <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"undefined method `#{sym}''"</span>)
|
261
|
-
723: <span class="ruby-comment cmt"># I was using super, but it was throwing a different error</span>
|
262
|
-
724: <span class="ruby-comment cmt"># which seemed wrong, not sure why</span>
|
263
|
-
725: <span class="ruby-keyword kw">end</span>
|
264
|
-
726: <span class="ruby-keyword kw">end</span>
|
265
|
-
</pre>
|
266
|
-
</div>
|
267
|
-
</div>
|
268
|
-
</div>
|
269
|
-
|
270
|
-
<div id="method-M000072" class="method-detail">
|
271
|
-
<a name="M000072"></a>
|
272
|
-
|
273
|
-
<div class="method-heading">
|
274
|
-
<a href="#M000072" class="method-signature">
|
275
|
-
<span class="method-name">raw_value</span><span class="method-args">()</span>
|
276
|
-
</a>
|
277
|
-
</div>
|
278
|
-
|
279
|
-
<div class="method-description">
|
280
|
-
<p><a class="source-toggle" href="#"
|
281
|
-
onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
|
282
|
-
<div class="method-source-code" id="M000072-source">
|
283
|
-
<pre>
|
284
|
-
<span class="ruby-comment cmt"># File lib/blocker.rb, line 704</span>
|
285
|
-
704: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">raw_value</span>
|
286
|
-
705: <span class="ruby-ivar">@value</span>
|
287
|
-
706: <span class="ruby-keyword kw">end</span>
|
288
|
-
</pre>
|
289
|
-
</div>
|
290
|
-
</div>
|
291
|
-
</div>
|
292
|
-
|
293
|
-
<div id="method-M000071" class="method-detail">
|
294
|
-
<a name="M000071"></a>
|
295
|
-
|
296
|
-
<div class="method-heading">
|
297
|
-
<a href="#M000071" class="method-signature">
|
298
|
-
<span class="method-name">value</span><span class="method-args">()</span>
|
299
|
-
</a>
|
300
|
-
</div>
|
301
|
-
|
302
|
-
<div class="method-description">
|
303
|
-
<p><a class="source-toggle" href="#"
|
304
|
-
onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
|
305
|
-
<div class="method-source-code" id="M000071-source">
|
306
|
-
<pre>
|
307
|
-
<span class="ruby-comment cmt"># File lib/blocker.rb, line 700</span>
|
308
|
-
700: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value</span>
|
309
|
-
701: <span class="ruby-keyword kw">self</span>
|
310
|
-
702: <span class="ruby-keyword kw">end</span>
|
311
|
-
</pre>
|
312
|
-
</div>
|
313
|
-
</div>
|
314
|
-
</div>
|
315
|
-
|
316
|
-
|
317
|
-
</div>
|
318
|
-
|
319
|
-
|
320
|
-
</div>
|
321
|
-
|
322
|
-
|
323
|
-
<div id="validator-badges">
|
324
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
325
|
-
</div>
|
326
|
-
|
327
|
-
</body>
|
328
|
-
</html>
|