Class: Seahorse::Client::Plugins::ReadCallbackIO Private
- Inherits:
-
Object
- Object
- Seahorse::Client::Plugins::ReadCallbackIO
- Extended by:
- Forwardable
- Defined in:
- lib/seahorse/client/plugins/request_callback.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #io ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(io, on_read = nil) ⇒ ReadCallbackIO
constructor
private
A new instance of ReadCallbackIO.
- #read(*args) ⇒ Object private
Constructor Details
#initialize(io, on_read = nil) ⇒ ReadCallbackIO
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ReadCallbackIO.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/seahorse/client/plugins/request_callback.rb', line 15 def initialize(io, on_read = nil) @io = io @on_read = on_read if on_read.is_a? Proc @bytes_read = 0 # Some IO objects support readpartial - IO.copy_stream used by the # request will call readpartial if available, so define a wrapper # for it if the underlying IO supports it. if @io.respond_to?(:readpartial) def self.readpartial(*args) @io.readpartial(*args).tap do |chunk| handle_chunk(chunk) end end end end |
Instance Attribute Details
#io ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/seahorse/client/plugins/request_callback.rb', line 32 def io @io end |
Instance Method Details
#read(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 38 |
# File 'lib/seahorse/client/plugins/request_callback.rb', line 34 def read(*args) @io.read(*args).tap do |chunk| handle_chunk(chunk) end end |