Module: Attached::Storage
- Defined in:
- lib/attached/storage.rb,
lib/attached/storage/aws.rb,
lib/attached/storage/fog.rb,
lib/attached/storage/base.rb,
lib/attached/storage/error.rb,
lib/attached/storage/local.rb,
lib/attached/storage/google.rb,
lib/attached/storage/rackspace.rb
Defined Under Namespace
Classes: AWS, Base, Error, Fog, Google, Local, Rackspace
Class Method Summary collapse
-
.storage(storage, credentials) ⇒ Object
Create a storage object given a medium and credentials.
Class Method Details
.storage(storage, credentials) ⇒ Object
Create a storage object given a medium and credentials.
Usage:
Attached::Storage.storage(:local)
Attached::Storage.storage(:aws, "#{Rails.root}/config/aws.yml" )
Attached::Storage.storage(:google, "#{Rails.root}/config/google.yml" )
Attached::Storage.storage(:rackspace, "#{Rails.root}/config/rackspace.yml")
Attached::Storage.storage(Attached::Storage::Custom.new)
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/attached/storage.rb', line 20 def self.storage(storage, credentials) return storage if storage.is_a? Attached::Storage::Base case storage when :aws then return Attached::Storage::AWS.new credentials when :google then return Attached::Storage::Google.new credentials when :rackspace then return Attached::Storage::Rackspace.new credentials when :local then return Attached::Storage::Local.new else raise "undefined storage '#{storage}'" end end |