stark 0.7.0 → 0.8.0
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/.travis.yml +10 -0
- data/History.txt +19 -0
- data/Manifest.txt +17 -3
- data/README.md +164 -0
- data/Rakefile +4 -1
- data/bin/stark +11 -3
- data/examples/README.md +114 -0
- data/examples/client.rb +13 -0
- data/examples/health.thrift +9 -0
- data/examples/server.rb +18 -0
- data/lib/stark.rb +16 -2
- data/lib/stark/ast.rb +5 -0
- data/lib/stark/client.rb +3 -67
- data/lib/stark/exception.rb +9 -9
- data/lib/stark/processor.rb +13 -52
- data/lib/stark/protocol_helpers.rb +161 -0
- data/lib/stark/raw_parser.rb +75 -14
- data/lib/stark/ruby.rb +267 -248
- data/lib/stark/struct.rb +37 -26
- data/lib/stark/thrift.kpeg +6 -4
- data/stark.gemspec +15 -15
- data/test/ThriftSpec.thrift +4 -0
- data/test/comments.thrift +15 -0
- data/test/leg.rb +0 -2
- data/test/parsing_error.thrift +5 -0
- data/test/properties.thrift +9 -0
- data/test/test_client.rb +116 -241
- data/test/test_coerce_strings.rb +187 -0
- data/test/test_helper.rb +113 -0
- data/test/test_marshal.rb +131 -0
- data/test/test_parser.rb +61 -0
- data/test/test_ruby.rb +148 -9
- data/test/test_server.rb +96 -212
- data/test/test_stark.rb +67 -0
- data/test/types.thrift +49 -0
- data/test/users.thrift +16 -0
- metadata +33 -15
- data/README.txt +0 -67
- data/lib/stark/converters.rb +0 -188
- data/lib/stark/field.rb +0 -27
data/test/test_stark.rb
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'test/unit'
|
|
2
|
+
|
|
3
|
+
require 'stark'
|
|
4
|
+
|
|
5
|
+
require 'rubygems'
|
|
6
|
+
require 'thrift'
|
|
7
|
+
|
|
8
|
+
class TestStark < Test::Unit::TestCase
|
|
9
|
+
def setup
|
|
10
|
+
@m = Module.new
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_materialize_parsing_errors
|
|
14
|
+
file_path = File.join(File.dirname(__FILE__), 'parsing_error.thrift')
|
|
15
|
+
begin
|
|
16
|
+
Stark.materialize file_path
|
|
17
|
+
rescue => e
|
|
18
|
+
error = e
|
|
19
|
+
end
|
|
20
|
+
assert(error, "A parsing exception should have been raised")
|
|
21
|
+
assert_equal(Stark::Parser::ParseError, error.class)
|
|
22
|
+
assert e.message.include?(file_path)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_materialize_service_with_struct_list
|
|
26
|
+
file_path = File.join(File.dirname(__FILE__), 'properties.thrift')
|
|
27
|
+
assert_nothing_raised do
|
|
28
|
+
Stark.materialize file_path, @m
|
|
29
|
+
end
|
|
30
|
+
assert @m.const_defined?(:Property)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_materialize_service_with_struct_set
|
|
34
|
+
file_path = File.join(File.dirname(__FILE__), 'users.thrift')
|
|
35
|
+
assert_nothing_raised do
|
|
36
|
+
Stark.materialize file_path, @m
|
|
37
|
+
end
|
|
38
|
+
assert @m.const_defined?(:User)
|
|
39
|
+
assert @m.const_defined?(:FavoriteUsers)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_materialize_service_with_comments
|
|
43
|
+
file_path = File.join(File.dirname(__FILE__), 'comments.thrift')
|
|
44
|
+
assert_nothing_raised do
|
|
45
|
+
Stark.materialize file_path, @m
|
|
46
|
+
end
|
|
47
|
+
assert @m.const_defined?(:Foo)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_materialize_service_with_throws
|
|
51
|
+
file_path = File.join(File.dirname(__FILE__), 'types.thrift')
|
|
52
|
+
assert_nothing_raised do
|
|
53
|
+
Stark.materialize file_path, @m
|
|
54
|
+
end
|
|
55
|
+
assert @m.const_defined?(:Types)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_materialize_with_stringio
|
|
59
|
+
file_path = File.join(File.dirname(__FILE__), 'types.thrift')
|
|
60
|
+
io = StringIO.new(File.read(file_path))
|
|
61
|
+
assert_nothing_raised do
|
|
62
|
+
Stark.materialize io, @m
|
|
63
|
+
end
|
|
64
|
+
assert @m.const_defined?(:Types)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
end
|
data/test/types.thrift
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
enum WhichField {
|
|
2
|
+
bool,
|
|
3
|
+
byte,
|
|
4
|
+
double,
|
|
5
|
+
i16,
|
|
6
|
+
i32,
|
|
7
|
+
i64,
|
|
8
|
+
string,
|
|
9
|
+
map,
|
|
10
|
+
list,
|
|
11
|
+
set,
|
|
12
|
+
list_of_structs
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
struct AllTypes {
|
|
16
|
+
1: bool a_bool
|
|
17
|
+
2: byte a_byte
|
|
18
|
+
3: double a_double
|
|
19
|
+
4: i16 an_i16
|
|
20
|
+
5: i32 an_i32
|
|
21
|
+
6: i64 an_i64
|
|
22
|
+
7: string a_string
|
|
23
|
+
8: map<byte,string> a_map
|
|
24
|
+
9: list<string> a_list
|
|
25
|
+
10: set<i32> a_set
|
|
26
|
+
11: list<Element> a_list_of_structs
|
|
27
|
+
12: WhichField field
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
struct Element {
|
|
31
|
+
1: i64 id
|
|
32
|
+
2: string name
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exception AnException {
|
|
36
|
+
1: string message
|
|
37
|
+
2: list<string> backtrace
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exception AnotherException {
|
|
41
|
+
1: string message
|
|
42
|
+
2: list<string> backtrace
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
service Types {
|
|
46
|
+
AllTypes get_all_types()
|
|
47
|
+
void set_all_types(1:AllTypes at)
|
|
48
|
+
void raise_error() throws(1:AnException ae, 2:AnotherException aae)
|
|
49
|
+
}
|
data/test/users.thrift
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
struct User {
|
|
2
|
+
1:string first_name,
|
|
3
|
+
2:string last_name,
|
|
4
|
+
3:string email
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
struct FavoriteUsers {
|
|
8
|
+
1:set<User> favorites
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
service UserService {
|
|
12
|
+
bool add_user(1:User user),
|
|
13
|
+
set<User> get_users(),
|
|
14
|
+
FavoriteUsers favorite_users(),
|
|
15
|
+
list<User> active_users()
|
|
16
|
+
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stark
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-05-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: thrift
|
|
@@ -34,7 +34,7 @@ dependencies:
|
|
|
34
34
|
requirements:
|
|
35
35
|
- - ~>
|
|
36
36
|
- !ruby/object:Gem::Version
|
|
37
|
-
version: '
|
|
37
|
+
version: '4.0'
|
|
38
38
|
type: :development
|
|
39
39
|
prerelease: false
|
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
requirements:
|
|
43
43
|
- - ~>
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
45
|
+
version: '4.0'
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
47
|
name: hoe
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - ~>
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '3.
|
|
53
|
+
version: '3.6'
|
|
54
54
|
type: :development
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -58,8 +58,8 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - ~>
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '3.
|
|
62
|
-
description: Optimized thrift bindings for ruby
|
|
61
|
+
version: '3.6'
|
|
62
|
+
description: Optimized thrift bindings for ruby.
|
|
63
63
|
email:
|
|
64
64
|
- evan@phx.io
|
|
65
65
|
executables:
|
|
@@ -68,23 +68,29 @@ extensions: []
|
|
|
68
68
|
extra_rdoc_files:
|
|
69
69
|
- History.txt
|
|
70
70
|
- Manifest.txt
|
|
71
|
-
- README.
|
|
71
|
+
- README.md
|
|
72
|
+
- examples/README.md
|
|
72
73
|
files:
|
|
73
74
|
- .autotest
|
|
75
|
+
- .gemtest
|
|
76
|
+
- .travis.yml
|
|
74
77
|
- History.txt
|
|
75
78
|
- Manifest.txt
|
|
76
|
-
- README.
|
|
79
|
+
- README.md
|
|
77
80
|
- Rakefile
|
|
78
81
|
- bin/stark
|
|
82
|
+
- examples/README.md
|
|
83
|
+
- examples/client.rb
|
|
84
|
+
- examples/health.thrift
|
|
85
|
+
- examples/server.rb
|
|
79
86
|
- lib/stark.rb
|
|
80
87
|
- lib/stark/ast.rb
|
|
81
88
|
- lib/stark/client.rb
|
|
82
|
-
- lib/stark/converters.rb
|
|
83
89
|
- lib/stark/exception.rb
|
|
84
|
-
- lib/stark/field.rb
|
|
85
90
|
- lib/stark/log_transport.rb
|
|
86
91
|
- lib/stark/parser.rb
|
|
87
92
|
- lib/stark/processor.rb
|
|
93
|
+
- lib/stark/protocol_helpers.rb
|
|
88
94
|
- lib/stark/raw_parser.rb
|
|
89
95
|
- lib/stark/ruby.rb
|
|
90
96
|
- lib/stark/struct.rb
|
|
@@ -92,6 +98,7 @@ files:
|
|
|
92
98
|
- stark.gemspec
|
|
93
99
|
- test/ThriftSpec.thrift
|
|
94
100
|
- test/blah.thrift
|
|
101
|
+
- test/comments.thrift
|
|
95
102
|
- test/gen-rb/profile_constants.rb
|
|
96
103
|
- test/gen-rb/profile_types.rb
|
|
97
104
|
- test/gen-rb/user_storage.rb
|
|
@@ -100,18 +107,25 @@ files:
|
|
|
100
107
|
- test/legacy_profile/profile_constants.rb
|
|
101
108
|
- test/legacy_profile/profile_types.rb
|
|
102
109
|
- test/legacy_profile/user_storage.rb
|
|
110
|
+
- test/parsing_error.thrift
|
|
103
111
|
- test/profile.thrift
|
|
112
|
+
- test/properties.thrift
|
|
104
113
|
- test/test_client.rb
|
|
114
|
+
- test/test_coerce_strings.rb
|
|
115
|
+
- test/test_helper.rb
|
|
116
|
+
- test/test_marshal.rb
|
|
105
117
|
- test/test_parser.rb
|
|
106
118
|
- test/test_ruby.rb
|
|
107
119
|
- test/test_server.rb
|
|
108
|
-
- .
|
|
120
|
+
- test/test_stark.rb
|
|
121
|
+
- test/types.thrift
|
|
122
|
+
- test/users.thrift
|
|
109
123
|
homepage: http://github.com/evanphx/stark
|
|
110
124
|
licenses: []
|
|
111
125
|
post_install_message:
|
|
112
126
|
rdoc_options:
|
|
113
127
|
- --main
|
|
114
|
-
- README.
|
|
128
|
+
- README.md
|
|
115
129
|
require_paths:
|
|
116
130
|
- lib
|
|
117
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -128,12 +142,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
128
142
|
version: '0'
|
|
129
143
|
requirements: []
|
|
130
144
|
rubyforge_project: stark
|
|
131
|
-
rubygems_version: 1.8.
|
|
145
|
+
rubygems_version: 1.8.23
|
|
132
146
|
signing_key:
|
|
133
147
|
specification_version: 3
|
|
134
|
-
summary: Optimized thrift bindings for ruby
|
|
148
|
+
summary: Optimized thrift bindings for ruby.
|
|
135
149
|
test_files:
|
|
136
150
|
- test/test_client.rb
|
|
151
|
+
- test/test_coerce_strings.rb
|
|
152
|
+
- test/test_helper.rb
|
|
153
|
+
- test/test_marshal.rb
|
|
137
154
|
- test/test_parser.rb
|
|
138
155
|
- test/test_ruby.rb
|
|
139
156
|
- test/test_server.rb
|
|
157
|
+
- test/test_stark.rb
|
data/README.txt
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
= stark
|
|
2
|
-
|
|
3
|
-
* http://github.com/evanphx/stark
|
|
4
|
-
|
|
5
|
-
== DESCRIPTION:
|
|
6
|
-
|
|
7
|
-
Optimized thrift bindings for ruby
|
|
8
|
-
|
|
9
|
-
== FEATURES/PROBLEMS:
|
|
10
|
-
|
|
11
|
-
* Generates much more straightforward code for thrift clients and servers
|
|
12
|
-
than the default thrift bindings for ruby
|
|
13
|
-
|
|
14
|
-
== SYNOPSIS:
|
|
15
|
-
|
|
16
|
-
$ stark service.thrift service.rb
|
|
17
|
-
require 'service'
|
|
18
|
-
|
|
19
|
-
OR
|
|
20
|
-
|
|
21
|
-
Stark.materialize "service.thrift"
|
|
22
|
-
|
|
23
|
-
Use Service::Client and Service::Processor like the default thrift
|
|
24
|
-
docs describe them.
|
|
25
|
-
|
|
26
|
-
== REQUIREMENTS:
|
|
27
|
-
|
|
28
|
-
* thrift gem
|
|
29
|
-
* .thift files
|
|
30
|
-
|
|
31
|
-
== INSTALL:
|
|
32
|
-
|
|
33
|
-
* gem install stark
|
|
34
|
-
|
|
35
|
-
== DEVELOPERS:
|
|
36
|
-
|
|
37
|
-
After checking out the source, run:
|
|
38
|
-
|
|
39
|
-
$ rake newb
|
|
40
|
-
|
|
41
|
-
This task will install any missing dependencies, run the tests/specs,
|
|
42
|
-
and generate the RDoc.
|
|
43
|
-
|
|
44
|
-
== LICENSE:
|
|
45
|
-
|
|
46
|
-
(The MIT License)
|
|
47
|
-
|
|
48
|
-
Copyright (c) 2013 Evan Phoenix
|
|
49
|
-
|
|
50
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
51
|
-
a copy of this software and associated documentation files (the
|
|
52
|
-
'Software'), to deal in the Software without restriction, including
|
|
53
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
54
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
55
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
56
|
-
the following conditions:
|
|
57
|
-
|
|
58
|
-
The above copyright notice and this permission notice shall be
|
|
59
|
-
included in all copies or substantial portions of the Software.
|
|
60
|
-
|
|
61
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
62
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
63
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
64
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
65
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
66
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
67
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/stark/converters.rb
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
require 'thrift'
|
|
2
|
-
|
|
3
|
-
module Stark
|
|
4
|
-
module Converters
|
|
5
|
-
module BYTE
|
|
6
|
-
module_function
|
|
7
|
-
|
|
8
|
-
def type
|
|
9
|
-
Thrift::Types::BYTE
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def read(ip)
|
|
13
|
-
ip.read_byte
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def write(op, value)
|
|
17
|
-
op.write_byte value
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
module I16
|
|
22
|
-
module_function
|
|
23
|
-
|
|
24
|
-
def type
|
|
25
|
-
Thrift::Types::I16
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def read(ip)
|
|
29
|
-
ip.read_i16
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def write(op, value)
|
|
33
|
-
op.write_i16 value
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
module I32
|
|
38
|
-
module_function
|
|
39
|
-
|
|
40
|
-
def type
|
|
41
|
-
Thrift::Types::I32
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def read(ip)
|
|
45
|
-
ip.read_i32
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def write(op, value)
|
|
49
|
-
op.write_i32 value
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
module I64
|
|
54
|
-
module_function
|
|
55
|
-
|
|
56
|
-
def type
|
|
57
|
-
Thrift::Types::I64
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def read(ip)
|
|
61
|
-
ip.read_i64
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def write(op, value)
|
|
65
|
-
op.write_i64 value
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
module BOOL
|
|
70
|
-
module_function
|
|
71
|
-
|
|
72
|
-
def type
|
|
73
|
-
Thrift::Types::BOOL
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def read(ip)
|
|
77
|
-
ip.read_bool
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def write(op, value)
|
|
81
|
-
op.write_bool value
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
module DOUBLE
|
|
86
|
-
module_function
|
|
87
|
-
|
|
88
|
-
def type
|
|
89
|
-
Thrift::Types::DOUBLE
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def read(ip)
|
|
93
|
-
ip.read_double
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def write(op, value)
|
|
97
|
-
op.write_double value
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
module STRING
|
|
102
|
-
module_function
|
|
103
|
-
|
|
104
|
-
def type
|
|
105
|
-
Thrift::Types::STRING
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def read(ip)
|
|
109
|
-
ip.read_string
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def write(op, value)
|
|
113
|
-
op.write_string value
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
class Struct
|
|
118
|
-
def initialize(cls)
|
|
119
|
-
@class = cls
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
def type
|
|
123
|
-
Thrift::Types::STRUCT
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
def read(ip)
|
|
127
|
-
obj = @class.new
|
|
128
|
-
obj.read ip
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
def write(op, value)
|
|
132
|
-
value.write op
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
class Enum
|
|
137
|
-
def initialize(cls)
|
|
138
|
-
@class = cls
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def type
|
|
142
|
-
Thrift::Types::I32
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def read(ip)
|
|
146
|
-
@class[ip.read_i32]
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def write(op, value)
|
|
150
|
-
op.write_i32 @class[value]
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
class List
|
|
155
|
-
def initialize(value)
|
|
156
|
-
@value = value
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
def type
|
|
160
|
-
Thrift::Types::LIST
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
def read(ip)
|
|
164
|
-
vt, size = ip.read_list_begin
|
|
165
|
-
|
|
166
|
-
if vt != @value.type
|
|
167
|
-
raise TypeError, "List expected to be type: #{@value.type}"
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
v = @value
|
|
171
|
-
|
|
172
|
-
Array.new(size) { v.read(ip) }
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
def write(op, value)
|
|
176
|
-
value = Array(value)
|
|
177
|
-
|
|
178
|
-
op.write_list_begin @value.type, value.size
|
|
179
|
-
|
|
180
|
-
c = @value
|
|
181
|
-
value.each { |v| c.write op, v }
|
|
182
|
-
|
|
183
|
-
op.write_list_end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
end
|