ruby-lzws 1.1.3 → 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 +55 -65
- data/ext/extconf.rb +9 -2
- data/ext/lzws_ext/buffer.c +18 -4
- data/ext/lzws_ext/common.h +3 -0
- data/ext/lzws_ext/error.c +0 -1
- data/ext/lzws_ext/error.h +2 -1
- data/ext/lzws_ext/io.c +4 -10
- data/ext/lzws_ext/main.c +2 -1
- data/ext/lzws_ext/option.c +22 -7
- data/ext/lzws_ext/option.h +28 -23
- data/ext/lzws_ext/stream/compressor.c +29 -39
- data/ext/lzws_ext/stream/compressor.h +5 -4
- data/ext/lzws_ext/stream/decompressor.c +24 -31
- data/ext/lzws_ext/stream/decompressor.h +5 -4
- data/ext/lzws_ext/string.c +60 -75
- data/lib/lzws/file.rb +4 -0
- data/lib/lzws/option.rb +32 -33
- data/lib/lzws/stream/abstract.rb +9 -12
- data/lib/lzws/stream/raw/abstract.rb +4 -2
- data/lib/lzws/stream/raw/compressor.rb +2 -4
- data/lib/lzws/stream/raw/decompressor.rb +1 -3
- data/lib/lzws/stream/reader.rb +71 -52
- data/lib/lzws/stream/writer.rb +10 -5
- data/lib/lzws/stream/writer_helpers.rb +6 -5
- data/lib/lzws/validation.rb +15 -2
- data/lib/lzws/version.rb +1 -1
- metadata +10 -24
@@ -13,13 +13,13 @@ module LZWS
|
|
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 LZWS
|
|
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/lzws/validation.rb
CHANGED
@@ -5,12 +5,25 @@ require_relative "error"
|
|
5
5
|
|
6
6
|
module LZWS
|
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)
|
@@ -22,7 +35,7 @@ module LZWS
|
|
22
35
|
end
|
23
36
|
|
24
37
|
def self.validate_io(value)
|
25
|
-
raise ValidateError, "invalid io" unless value.
|
38
|
+
raise ValidateError, "invalid io" unless IO_METHODS.all? { |method| value.respond_to? method }
|
26
39
|
end
|
27
40
|
|
28
41
|
def self.validate_hash(value)
|
data/lib/lzws/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lzws
|
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:
|
11
|
+
date: 2020-10-14 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
|
@@ -100,42 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
103
|
+
version: '0.93'
|
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.93'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop-performance
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
117
|
+
version: '1.8'
|
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: '1.
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-rails
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '2.3'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '2.3'
|
124
|
+
version: '1.8'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
126
|
name: simplecov
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,14 +193,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
193
|
requirements:
|
208
194
|
- - ">="
|
209
195
|
- !ruby/object:Gem::Version
|
210
|
-
version: '
|
196
|
+
version: '2.5'
|
211
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
198
|
requirements:
|
213
199
|
- - ">="
|
214
200
|
- !ruby/object:Gem::Version
|
215
201
|
version: '0'
|
216
202
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
203
|
+
rubygems_version: 3.1.4
|
218
204
|
signing_key:
|
219
205
|
specification_version: 4
|
220
206
|
summary: Ruby bindings for lzws library.
|