Class: S3FileCache::S3Object

Inherits:
Object
  • Object
show all
Defined in:
app/models/s3_file_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(bucket_name, path) ⇒ S3Object

Returns a new instance of S3Object.



62
63
64
65
# File 'app/models/s3_file_cache.rb', line 62

def initialize(bucket_name, path)
  @bucket = Aws::S3::Resource.new(client: client).bucket(bucket_name)
  @path   = path
end

Instance Method Details

#getObject



67
68
69
70
71
72
73
74
75
# File 'app/models/s3_file_cache.rb', line 67

def get
  body = @bucket.object(@path).get.body

  if block_given?
    yield body
  else
    body
  end
end