Class: Pantry::Communication::FileService::SendingFile
- Inherits:
-
UploadInfo
- Object
- UploadInfo
- Pantry::Communication::FileService::SendingFile
- Defined in:
- lib/pantry/communication/file_service/file_progress.rb
Overview
Sending-side version of UploadInfo
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Attributes inherited from UploadInfo
Instance Method Summary collapse
- #finished! ⇒ Object
- #finished? ⇒ Boolean
-
#initialize(file_path, receiver_uuid, file_uuid) ⇒ SendingFile
constructor
A new instance of SendingFile.
- #read(offset, bytes_to_read) ⇒ Object
Methods inherited from UploadInfo
Constructor Details
#initialize(file_path, receiver_uuid, file_uuid) ⇒ SendingFile
Returns a new instance of SendingFile.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/pantry/communication/file_service/file_progress.rb', line 34 def initialize(file_path, receiver_uuid, file_uuid) super() @path = file_path @file_uuid = file_uuid @file = File.open(@path, "r") @receiver_uuid = receiver_uuid @file_size = @file.size @total_bytes_sent = 0 Pantry.ui.progress_start(@file_size) end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
32 33 34 |
# File 'lib/pantry/communication/file_service/file_progress.rb', line 32 def file @file end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
32 33 34 |
# File 'lib/pantry/communication/file_service/file_progress.rb', line 32 def path @path end |
Instance Method Details
#finished! ⇒ Object
56 57 58 59 60 61 |
# File 'lib/pantry/communication/file_service/file_progress.rb', line 56 def finished! Pantry.ui.progress_finish @file.close super end |
#finished? ⇒ Boolean
63 64 65 |
# File 'lib/pantry/communication/file_service/file_progress.rb', line 63 def finished? @total_bytes_sent == @file_size || @file.closed? end |