filter_io 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/filter_io.rb +1 -1
- data/lib/filter_io/version.rb +1 -1
- data/spec/filter_io_spec.rb +12 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc38739abd36195531c35e95d911431541316712
|
4
|
+
data.tar.gz: 88e785cac1212c8993ef66718f169042f6abea69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdcc4feed07d99daac57cc8cb272673025e5bd6b1cf5f6c227e565fbd9cb87f6c283c7dce6cf102a8f7640dcfccf9f7c7fb6f315bc888f13faa5f22c60b7f5b8
|
7
|
+
data.tar.gz: f9fe882d09ca94f3183c00551fd6596915683adfd2d699cce6a5eb612276da428e36d9c5a85b70053e3991cfbfe6f7999ca2c35db6bca31572cd38b1c3847a1f
|
data/lib/filter_io.rb
CHANGED
@@ -367,7 +367,7 @@ class FilterIO
|
|
367
367
|
rescue Errno::ESPIPE
|
368
368
|
@source_pos
|
369
369
|
end
|
370
|
-
args << BlockState.new(src_pos == data.
|
370
|
+
args << BlockState.new(src_pos == data.bytesize, source_eof?)
|
371
371
|
end
|
372
372
|
data = @block.call(*args)
|
373
373
|
raise IOError, 'Block returned nil' if data.nil?
|
data/lib/filter_io/version.rb
CHANGED
data/spec/filter_io_spec.rb
CHANGED
@@ -348,6 +348,18 @@ describe FilterIO do
|
|
348
348
|
expect(io.read).to eq expected
|
349
349
|
end
|
350
350
|
|
351
|
+
it 'passes true for BOF to the block when stream starts with a UTF-8 BOM' do
|
352
|
+
input = "\xEF\xBB\xBFTest String"
|
353
|
+
expected = ">>>*\xEF\xBB\xBFT**est **Stri**ng*<<<"
|
354
|
+
io = FilterIO.new(StringIO.new(input), :block_size => 4) do |data, state|
|
355
|
+
data = "*#{data}*"
|
356
|
+
data = ">>>#{data}" if state.bof?
|
357
|
+
data = "#{data}<<<" if state.eof?
|
358
|
+
data
|
359
|
+
end
|
360
|
+
expect(io.read).to eq expected
|
361
|
+
end
|
362
|
+
|
351
363
|
it 'passes false for BOF to the block if stream previously read' do
|
352
364
|
input = StringIO.new 'Test String'
|
353
365
|
expect(input.read(4)).to eq 'Test'
|
@@ -821,11 +833,6 @@ describe FilterIO do
|
|
821
833
|
expect {
|
822
834
|
filtered_io.gets
|
823
835
|
}.to raise_error IOError
|
824
|
-
|
825
|
-
# closing again should raise an error
|
826
|
-
expect {
|
827
|
-
filtered_io.close
|
828
|
-
}.to raise_error IOError
|
829
836
|
end
|
830
837
|
end
|
831
838
|
|
@@ -955,5 +962,4 @@ describe FilterIO do
|
|
955
962
|
|
956
963
|
expect(dest.string).to eq 'FOO'
|
957
964
|
end
|
958
|
-
|
959
965
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filter_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Weathered
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.6.11
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Filter IO streams with a block. Ruby's FilterInputStream.
|