Class: Nokogiri::Streaming::IOWrapper
- Inherits:
-
Object
- Object
- Nokogiri::Streaming::IOWrapper
- Defined in:
- lib/nokogiri/streaming/reader.rb
Overview
IO wrapper which traps stream exceptions. This works around bug in Nokogiri’s SAX code, which seems to ignore exceptions entirely.
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(source) ⇒ IOWrapper
constructor
A new instance of IOWrapper.
- #read(length = nil) ⇒ Object
Constructor Details
#initialize(source) ⇒ IOWrapper
Returns a new instance of IOWrapper.
116 117 118 |
# File 'lib/nokogiri/streaming/reader.rb', line 116 def initialize(source) @source = source end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
133 134 135 |
# File 'lib/nokogiri/streaming/reader.rb', line 133 def exception @exception end |
Instance Method Details
#close ⇒ Object
129 130 131 |
# File 'lib/nokogiri/streaming/reader.rb', line 129 def close @stream.close end |
#read(length = nil) ⇒ Object
120 121 122 123 124 125 126 127 |
# File 'lib/nokogiri/streaming/reader.rb', line 120 def read(length = nil) begin return @source.read(length) rescue => e @exception = e raise end end |