filter_io 0.2.6 → 0.2.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a31b33c49d022a4d843c22358d84cc2617c2c9b
4
- data.tar.gz: 6a5fc3060b2192db6dfe7a01cdfa0fc470df52a0
3
+ metadata.gz: 88a035f96c444d4c3c91aa87b0bb7628c8d9092b
4
+ data.tar.gz: 26497c89876324625e20fd824cfb83d04288b4e5
5
5
  SHA512:
6
- metadata.gz: 027ae9db72c8aabb4922f035975091ee8ea1859d1db24f66774e078dcd4d6d987c0b942a0d4049e0c23c8cf99402399ddf1d502947cde6c63546ba36d74478f7
7
- data.tar.gz: 2c50d946d7b86b86ffbc6483e0561d93d868cfc9c63433e284d37ffa746fa2aeb75670528198a239da8dbf124d00af1c8bc290974e6cd83763ea8d74cd584033
6
+ metadata.gz: f3f82c288657ac02c89afb0a32a3f66ea473dc83d901c6f463cd548297de2b2a7293b80575f72a1bbc05567b858411f9cec103ff0b3a838b0abb68ec0a23c98a
7
+ data.tar.gz: a270fe4c534c2193a35a31561157979774938036437ece8e26d5333ff658aff9085ab99b4bc803cec4ae32de228baccde59d9d7c7bdcdc8685e6afdf19c88e48
data/lib/filter_io.rb CHANGED
@@ -309,7 +309,7 @@ class FilterIO
309
309
  data = @buffer_raw.slice! 0, @buffer_raw.bytesize
310
310
  elsif data = @io.read(block_size)
311
311
  @source_pos += data.bytesize
312
- data.force_encoding(external_encoding)
312
+ data.force_encoding(external_encoding) if external_encoding
313
313
  else
314
314
  data = ""
315
315
  end
@@ -1,3 +1,3 @@
1
1
  class FilterIO
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
3
3
  end
@@ -940,4 +940,20 @@ describe FilterIO do
940
940
  expect(io.read).to eq ""
941
941
  end
942
942
 
943
+ it 'works with Tempfile and IO.copy_stream' do
944
+ src_io = Tempfile.new('filter_io')
945
+ src_io << 'foo'
946
+ src_io.flush
947
+ src_io.rewind
948
+
949
+ io = FilterIO.new src_io do |data, state|
950
+ data.upcase
951
+ end
952
+
953
+ dest = StringIO.new
954
+ IO.copy_stream(io, dest)
955
+
956
+ expect(dest.string).to eq 'FOO'
957
+ end
958
+
943
959
  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.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Weathered
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-03 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler