nokogiri-streaming-reader 1.1 → 1.1.1

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: 37fc22b99e9fd94795e988f57082726da98ef508
4
- data.tar.gz: e3bb119767f3a94f69f6f9bad22c5a77c515d58d
3
+ metadata.gz: da58b88e2dc1bec230f86ec4c1740f1f9121d984
4
+ data.tar.gz: c5c1bd599014dd289ef567a02bf8812ce1644495
5
5
  SHA512:
6
- metadata.gz: bb074d9be0e846dd89a034f026ba01c38224426a94f7cbba99dfd623d1a33dd804b53c52ff3a5300c2150ddbd4cc23c7b7e58f56dec73dfabb168841800fbb92
7
- data.tar.gz: 79d289710b6dc9869e59639bfafb33806299021f0ec8fa42429cb7d7c01600b962ba9bc0682aad1950936a0ac5438c5005acab61521e7c695f1543fbc4f0e54a
6
+ metadata.gz: 0e57f4d06b42433747cb53ce9ef317f22ac410f426419636c7fa18bb7308c04ebe4a4a74a7d4de170f07cddc6898a18bb339f65a47646b921d965d957763b454
7
+ data.tar.gz: 202fb2912eea63133ec9e8094360d8106ea54b9e1c8f01dc274392a55f8d1659f8738d0ba50e4162b2439138f4aaae3ccf934611893b5581463f89cc24651c04
@@ -3,36 +3,13 @@ require 'nokogiri'
3
3
  module Nokogiri
4
4
  module Streaming
5
5
 
6
- # IO wrapper which traps stream exceptions. This works around bug in Nokogiri's
7
- # SAX code, which seems to ignore exceptions entirely.
8
- class IOWrapper
9
- def initialize(source)
10
- @source = source
11
- end
12
-
13
- def read(length = nil)
14
- begin
15
- return @source.read(length)
16
- rescue => e
17
- @exception = e
18
- raise
19
- end
20
- end
21
-
22
- def close
23
- @stream.close
24
- end
25
-
26
- attr_reader :exception
27
- end
28
-
29
6
  class ParseError < StandardError; end
30
7
 
31
8
  class Reader < XML::SAX::Document
32
9
 
33
- def initialize(source)
10
+ def initialize(source, encoding: 'utf-8')
34
11
  @source = IOWrapper.new(source)
35
- @parser = Nokogiri::XML::SAX::Parser.new(self)
12
+ @parser = Nokogiri::XML::SAX::Parser.new(self, encoding)
36
13
  @stack = []
37
14
  @end_triggers = {}
38
15
  @start_triggers = {}
@@ -131,5 +108,30 @@ module Nokogiri
131
108
 
132
109
  end
133
110
 
111
+ private
112
+
113
+ # IO wrapper which traps stream exceptions. This works around bug in Nokogiri's
114
+ # SAX code, which seems to ignore exceptions entirely.
115
+ class IOWrapper
116
+ def initialize(source)
117
+ @source = source
118
+ end
119
+
120
+ def read(length = nil)
121
+ begin
122
+ return @source.read(length)
123
+ rescue => e
124
+ @exception = e
125
+ raise
126
+ end
127
+ end
128
+
129
+ def close
130
+ @stream.close
131
+ end
132
+
133
+ attr_reader :exception
134
+ end
135
+
134
136
  end
135
137
  end
@@ -1,5 +1,5 @@
1
1
  module Nokogiri
2
2
  module Streaming
3
- VERSION = '1.1'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ["lib"]
22
22
 
23
+ spec.required_ruby_version = '>= 2.0'
24
+
23
25
  spec.add_dependency "nokogiri", ">= 1.4"
24
26
  spec.add_development_dependency "bundler", "~> 1.5"
25
27
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri-streaming-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Staubo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-29 00:00:00.000000000 Z
11
+ date: 2017-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: '0'
98
+ version: '2.0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -103,10 +103,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.5.2
106
+ rubygems_version: 2.4.5.2
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: Simple streaming reader for Nokogiri.
110
110
  test_files:
111
111
  - spec/reader_spec.rb
112
112
  - spec/spec_helper.rb
113
+ has_rdoc: