Class: Daytona::MultipartDownloadStreamParser
- Inherits:
-
Object
- Object
- Daytona::MultipartDownloadStreamParser
- Defined in:
- lib/daytona/file_transfer.rb
Instance Attribute Summary collapse
-
#boundary_token ⇒ Object
writeonly
Sets the attribute boundary_token.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
Instance Method Summary collapse
- #<<(chunk) ⇒ Object
- #finish! ⇒ Object
-
#initialize(&on_file_chunk) ⇒ MultipartDownloadStreamParser
constructor
A new instance of MultipartDownloadStreamParser.
Constructor Details
#initialize(&on_file_chunk) ⇒ MultipartDownloadStreamParser
Returns a new instance of MultipartDownloadStreamParser.
14 15 16 17 18 19 20 21 |
# File 'lib/daytona/file_transfer.rb', line 14 def initialize(&on_file_chunk) @on_file_chunk = on_file_chunk @boundary_token = nil @buffer = String.new.b @state = :preamble @part_name = nil @error_buffer = String.new.b end |
Instance Attribute Details
#boundary_token=(value) ⇒ Object (writeonly)
Sets the attribute boundary_token
12 13 14 |
# File 'lib/daytona/file_transfer.rb', line 12 def boundary_token=(value) @boundary_token = value end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
11 12 13 |
# File 'lib/daytona/file_transfer.rb', line 11 def @error_message end |
Instance Method Details
#<<(chunk) ⇒ Object
23 24 25 26 |
# File 'lib/daytona/file_transfer.rb', line 23 def <<(chunk) @buffer << chunk.b process! end |
#finish! ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/daytona/file_transfer.rb', line 28 def finish! process! return if @state == :done || @buffer.empty? emit(@buffer) finalize_part! @buffer = String.new.b @state = :done end |