ruby-brs 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +87 -85
- data/ext/brs_ext/buffer.c +21 -7
- data/ext/brs_ext/buffer.h +7 -7
- data/ext/brs_ext/common.h +3 -0
- data/ext/brs_ext/error.c +0 -1
- data/ext/brs_ext/error.h +2 -1
- data/ext/brs_ext/gvl.h +24 -0
- data/ext/brs_ext/io.c +273 -157
- data/ext/brs_ext/main.c +0 -1
- data/ext/brs_ext/option.c +37 -30
- data/ext/brs_ext/option.h +39 -32
- data/ext/brs_ext/stream/compressor.c +124 -61
- data/ext/brs_ext/stream/compressor.h +7 -4
- data/ext/brs_ext/stream/decompressor.c +60 -31
- data/ext/brs_ext/stream/decompressor.h +7 -4
- data/ext/brs_ext/string.c +118 -66
- data/ext/extconf.rb +9 -0
- data/lib/brs/file.rb +4 -0
- data/lib/brs/option.rb +6 -0
- data/lib/brs/stream/abstract.rb +9 -12
- data/lib/brs/stream/raw/abstract.rb +6 -2
- data/lib/brs/stream/raw/compressor.rb +3 -7
- data/lib/brs/stream/raw/decompressor.rb +1 -5
- data/lib/brs/stream/reader.rb +71 -52
- data/lib/brs/stream/writer.rb +10 -5
- data/lib/brs/stream/writer_helpers.rb +6 -5
- data/lib/brs/validation.rb +15 -2
- data/lib/brs/version.rb +1 -1
- metadata +20 -19
@@ -13,13 +13,13 @@ module BRS
|
|
13
13
|
write object
|
14
14
|
end
|
15
15
|
|
16
|
-
def print(*objects)
|
16
|
+
def print(*objects, field_separator: $OUTPUT_FIELD_SEPARATOR, record_separator: $OUTPUT_RECORD_SEPARATOR)
|
17
17
|
objects.each do |object|
|
18
18
|
write object
|
19
|
-
write
|
19
|
+
write field_separator unless field_separator.nil?
|
20
20
|
end
|
21
21
|
|
22
|
-
write
|
22
|
+
write record_separator unless record_separator.nil?
|
23
23
|
|
24
24
|
nil
|
25
25
|
end
|
@@ -31,9 +31,10 @@ module BRS
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def putc(object, encoding: ::Encoding::BINARY)
|
34
|
-
|
34
|
+
case object
|
35
|
+
when ::Numeric
|
35
36
|
write object.chr(encoding)
|
36
|
-
|
37
|
+
when ::String
|
37
38
|
write object[0]
|
38
39
|
else
|
39
40
|
raise ValidateError, "invalid object: \"#{object}\" for putc"
|
data/lib/brs/validation.rb
CHANGED
@@ -5,12 +5,25 @@ require_relative "error"
|
|
5
5
|
|
6
6
|
module BRS
|
7
7
|
module Validation
|
8
|
+
IO_METHODS = %i[
|
9
|
+
read
|
10
|
+
write
|
11
|
+
readpartial
|
12
|
+
read_nonblock
|
13
|
+
write_nonblock
|
14
|
+
eof?
|
15
|
+
flush
|
16
|
+
close
|
17
|
+
closed?
|
18
|
+
]
|
19
|
+
.freeze
|
20
|
+
|
8
21
|
def self.validate_bool(value)
|
9
22
|
raise ValidateError, "invalid bool" unless value.is_a?(::TrueClass) || value.is_a?(::FalseClass)
|
10
23
|
end
|
11
24
|
|
12
25
|
def self.validate_positive_integer(value)
|
13
|
-
raise ValidateError, "invalid positive integer" unless value.is_a?(::Integer) && value
|
26
|
+
raise ValidateError, "invalid positive integer" unless value.is_a?(::Integer) && value.positive?
|
14
27
|
end
|
15
28
|
|
16
29
|
def self.validate_not_negative_integer(value)
|
@@ -26,7 +39,7 @@ module BRS
|
|
26
39
|
end
|
27
40
|
|
28
41
|
def self.validate_io(value)
|
29
|
-
raise ValidateError, "invalid io" unless value.
|
42
|
+
raise ValidateError, "invalid io" unless IO_METHODS.all? { |method| value.respond_to? method }
|
30
43
|
end
|
31
44
|
|
32
45
|
def self.validate_hash(value)
|
data/lib/brs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-brs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Aladjev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ocg
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: parallel
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: rake
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,47 +95,47 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rake-compiler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop
|
112
|
+
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0.93'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0.93'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-
|
126
|
+
name: rubocop-performance
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '1.8'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '1.8'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- ext/brs_ext/common.h
|
166
166
|
- ext/brs_ext/error.c
|
167
167
|
- ext/brs_ext/error.h
|
168
|
+
- ext/brs_ext/gvl.h
|
168
169
|
- ext/brs_ext/io.c
|
169
170
|
- ext/brs_ext/io.h
|
170
171
|
- ext/brs_ext/macro.h
|
@@ -207,14 +208,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
208
|
requirements:
|
208
209
|
- - ">="
|
209
210
|
- !ruby/object:Gem::Version
|
210
|
-
version: '
|
211
|
+
version: '2.5'
|
211
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
213
|
requirements:
|
213
214
|
- - ">="
|
214
215
|
- !ruby/object:Gem::Version
|
215
216
|
version: '0'
|
216
217
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
218
|
+
rubygems_version: 3.1.4
|
218
219
|
signing_key:
|
219
220
|
specification_version: 4
|
220
221
|
summary: Ruby bindings for brotli library.
|