filter_io 0.2.9 → 0.2.10

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
  SHA256:
3
- metadata.gz: ced2c65cffd42c6978d3baef95fafe4ce41a6442d8d68e8a5743af02bf9ed4bf
4
- data.tar.gz: 742d007fdb81e2bfa1bf9276748b66f36284a4147242fa1843a7022be8bd65a5
3
+ metadata.gz: 6bb6c9bf480676e8e8f76bc297c78b2898cca42d2a4b366d62b117c5edf73167
4
+ data.tar.gz: c9994613dd2f4baad9eb51a8403e821ffae1faa3f1bcaa0edb3c1969349efccf
5
5
  SHA512:
6
- metadata.gz: d470cdb65d41eb4c18921df0438b5fe4c43098c7ecb2c581200aa7180cba27269df31da29a99c9d6cce94727410ee05381b0fce263d2ad970b7af9a817ed49fa
7
- data.tar.gz: 8cc94e7348e0abfac77832599bec162f95c37e4c10a155c0ecce27b2454400bbc2cc953e5152490bb7ed3b8e659cd221aca4b844a48333016acf8c33fc75fe6e
6
+ metadata.gz: 027622b16c8febb4e1cc978f603bbb9c4d1527c13bed972a0633ef61015593d728728d61c18a87c80c141849796c50acbfde8d7cd775de773eb6cd441389b5ad
7
+ data.tar.gz: 6dc6d5c4d8ecb4ebf980bde869091ed0afeee5380e4e61dfbef1dab9add5bafbf1ea99327038d5460a3b1e7f53ca81f01f2e103694fbe335f1def9098d00d79e
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.5
data/filter_io.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_development_dependency 'bundler', '~> 2.0'
21
- spec.add_development_dependency 'rake', '< 2'
21
+ spec.add_development_dependency 'rake'
22
22
  spec.add_development_dependency 'simplecov'
23
- spec.add_development_dependency 'rspec', '~> 2.13'
23
+ spec.add_development_dependency 'rspec', '~> 3.0'
24
24
  spec.add_development_dependency 'pry'
25
25
  end
@@ -1,3 +1,3 @@
1
1
  class FilterIO
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.10'
3
3
  end
data/lib/filter_io.rb CHANGED
@@ -54,12 +54,11 @@ class FilterIO
54
54
  end
55
55
 
56
56
  def default_encoding
57
- unless @default_encoding
57
+ @default_encoding ||= begin
58
58
  c = @io.getc
59
59
  @io.ungetc c
60
- @default_encoding = c.encoding
60
+ c.encoding
61
61
  end
62
- @default_encoding
63
62
  end
64
63
 
65
64
  def internal_encoding
@@ -103,6 +102,7 @@ class FilterIO
103
102
  return '' if length == 0
104
103
 
105
104
  # fill the buffer up to the fill level (or whole input if length is nil)
105
+ @did_first_read ||= false
106
106
  while (!source_eof? || !@did_first_read) && (length.nil? || length > @buffer.bytesize)
107
107
  @did_first_read = true
108
108
  buffer_data @options[:block_size] || length
@@ -325,7 +325,7 @@ class FilterIO
325
325
  # and add some more data to the buffer
326
326
  raise NeedMoreData
327
327
  end
328
- rescue NeedMoreData => e
328
+ rescue NeedMoreData
329
329
  raise EOFError, 'end of file reached' if @io.eof?
330
330
  new_data = @io.read(block_size).force_encoding(external_encoding)
331
331
  data << new_data
@@ -206,7 +206,7 @@ describe FilterIO do
206
206
 
207
207
  it 'converts ISO-8859-1 to UTF-8 via a block' do
208
208
  [1, 2, nil].each do |block_size|
209
- expected = "über\nrésumé"
209
+ # expected: "über\nrésumé"
210
210
  with_iso8859_1_test_file 'UTF-8' do |io_raw|
211
211
  io = FilterIO.new(io_raw, :block_size => block_size) do |data, state|
212
212
  if state.bof?
@@ -227,7 +227,7 @@ describe FilterIO do
227
227
 
228
228
  it 'converts ISO-8859-1 to raw via a block' do
229
229
  [1, 2, nil].each do |block_size|
230
- expected = "über\nrésumé".encode('ISO-8859-1')
230
+ # expected: "über\nrésumé".encode('ISO-8859-1')
231
231
  with_iso8859_1_test_file 'ISO-8859-1' do |io_raw|
232
232
  io = FilterIO.new(io_raw, :block_size => block_size) do |data, state|
233
233
  if state.bof?
@@ -465,7 +465,7 @@ describe FilterIO do
465
465
 
466
466
  it 'can be rewound with block' do
467
467
  input = 'abcdefghij'
468
- expected = input[1..-1]
468
+ # expected: input[1..-1]
469
469
  io = FilterIO.new(StringIO.new(input), :block_size => 4) do |data, state|
470
470
  data = data[1..-1] if state.bof?
471
471
  data
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.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Weathered
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-19 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "<"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.13'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.13'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
+ - ".tool-versions"
91
92
  - Gemfile
92
93
  - LICENSE
93
94
  - README.markdown
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  requirements: []
119
- rubygems_version: 3.1.6
120
+ rubygems_version: 3.2.32
120
121
  signing_key:
121
122
  specification_version: 4
122
123
  summary: Filter IO streams with a block. Ruby's FilterInputStream.