Class: Hobo::Lib::S3::Local::File

Inherits:
Object
  • Object
show all
Defined in:
lib/hobo/lib/s3/local/file.rb

Instance Method Summary collapse

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

#bufferObject



10
11
12
# File 'lib/hobo/lib/s3/local/file.rb', line 10

def buffer
  # NOP
end

#closeObject



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

#sizeObject



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