Class: Hobo::Lib::S3::Local::File
- Inherits:
-
Object
- Object
- Hobo::Lib::S3::Local::File
- Defined in:
- lib/hobo/lib/s3/local/file.rb
Instance Method Summary collapse
- #buffer ⇒ Object
- #close ⇒ Object
-
#initialize(file) ⇒ File
constructor
A new instance of File.
- #read(bytes) ⇒ Object
- #size ⇒ Object
- #write(opts = {}) ⇒ Object
Constructor Details
#initialize(file) ⇒ File
Returns a new instance of File.
6 7 8 |
# File 'lib/hobo/lib/s3/local/file.rb', line 6 def initialize file @file = file end |
Instance Method Details
#buffer ⇒ Object
10 11 12 |
# File 'lib/hobo/lib/s3/local/file.rb', line 10 def buffer # NOP end |
#close ⇒ Object
29 30 31 |
# File 'lib/hobo/lib/s3/local/file.rb', line 29 def close @file.close end |
#read(bytes) ⇒ Object
14 15 16 |
# File 'lib/hobo/lib/s3/local/file.rb', line 14 def read bytes @file.read bytes end |
#size ⇒ Object
25 26 27 |
# File 'lib/hobo/lib/s3/local/file.rb', line 25 def size @file.size end |
#write(opts = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/hobo/lib/s3/local/file.rb', line 18 def write opts = {} opts = { :chunk_size => 4096 }.merge(opts) while @file.size < opts[:size] do yield @file, opts[:chunk_size] end end |