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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88a035f96c444d4c3c91aa87b0bb7628c8d9092b
4
- data.tar.gz: 26497c89876324625e20fd824cfb83d04288b4e5
3
+ metadata.gz: fc38739abd36195531c35e95d911431541316712
4
+ data.tar.gz: 88e785cac1212c8993ef66718f169042f6abea69
5
5
  SHA512:
6
- metadata.gz: f3f82c288657ac02c89afb0a32a3f66ea473dc83d901c6f463cd548297de2b2a7293b80575f72a1bbc05567b858411f9cec103ff0b3a838b0abb68ec0a23c98a
7
- data.tar.gz: a270fe4c534c2193a35a31561157979774938036437ece8e26d5333ff658aff9085ab99b4bc803cec4ae32de228baccde59d9d7c7bdcdc8685e6afdf19c88e48
6
+ metadata.gz: fdcc4feed07d99daac57cc8cb272673025e5bd6b1cf5f6c227e565fbd9cb87f6c283c7dce6cf102a8f7640dcfccf9f7c7fb6f315bc888f13faa5f22c60b7f5b8
7
+ data.tar.gz: f9fe882d09ca94f3183c00551fd6596915683adfd2d699cce6a5eb612276da428e36d9c5a85b70053e3991cfbfe6f7999ca2c35db6bca31572cd38b1c3847a1f
@@ -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.length, source_eof?)
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?
@@ -1,3 +1,3 @@
1
1
  class FilterIO
2
- VERSION = '0.2.7'
2
+ VERSION = '0.2.8'
3
3
  end
@@ -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.7
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: 2015-03-05 00:00:00.000000000 Z
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.2.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.