Class: CarrierWave::Storage::AWS
- Inherits:
-
Abstract
- Object
- Abstract
- CarrierWave::Storage::AWS
- Defined in:
- lib/carrierwave/storage/aws.rb
Defined Under Namespace
Classes: File
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.clear_connection_cache! ⇒ Object
10 11 12 |
# File 'lib/carrierwave/storage/aws.rb', line 10 def self.clear_connection_cache! @connection_cache = {} end |
.connection_cache ⇒ Object
6 7 8 |
# File 'lib/carrierwave/storage/aws.rb', line 6 def self.connection_cache @connection_cache ||= {} end |
Instance Method Details
#connection ⇒ Object
24 25 26 27 28 29 |
# File 'lib/carrierwave/storage/aws.rb', line 24 def connection @connection ||= begin credentials = uploader.aws_credentials self.class.connection_cache[credentials] ||= ::AWS::S3.new(credentials) end end |
#retrieve!(identifier) ⇒ Object
20 21 22 |
# File 'lib/carrierwave/storage/aws.rb', line 20 def retrieve!(identifier) File.new(uploader, connection, uploader.store_path(identifier)) end |
#store!(file) ⇒ Object
14 15 16 17 18 |
# File 'lib/carrierwave/storage/aws.rb', line 14 def store!(file) File.new(uploader, connection, uploader.store_path).tap do |aws_file| aws_file.store(file) end end |