Class: Fakerclip::Writes::FakeS3::LocalS3Object

Inherits:
Object
  • Object
show all
Defined in:
lib/fakerclip/writes.rb

Instance Method Summary collapse

Constructor Details

#initialize(s3_bucket, s3_file_path) ⇒ LocalS3Object

Returns a new instance of LocalS3Object.



64
65
66
67
68
# File 'lib/fakerclip/writes.rb', line 64

def initialize(s3_bucket, s3_file_path)
  @local_file_path = File.join(path_to_local_s3, s3_bucket, s3_file_path)

  ensure_path_exists
end

Instance Method Details

#save(data) ⇒ Object

writes the file to the fake s3



71
72
73
# File 'lib/fakerclip/writes.rb', line 71

def save(data)
  File.open(@local_file_path, "wb") {|file| file.write(data) }
end