# File lib/carrierwave/uploader/configuration.rb, line 105 def add_config(name) class_eval " def self.#{name}(value=nil) @#{name} = value if value return @#{name} if self.object_id == #{self.object_id} || defined?(@#{name}) name = superclass.#{name} return nil if name.nil? && !instance_variable_defined?("@#{name}") @#{name} = name && !name.is_a?(Module) && !name.is_a?(Symbol) && !name.is_a?(Numeric) && !name.is_a?(TrueClass) && !name.is_a?(FalseClass) ? name.dup : name end def self.#{name}=(value) @#{name} = value end def #{name} self.class.#{name} end ", __FILE__, __LINE__ + 1 end
# File lib/carrierwave/uploader/configuration.rb, line 125 def configure yield self end
Sets the storage engine to be used when storing files with this uploader. Can be any class that implements a store!(CarrierWave::SanitizedFile) and a retrieve! method. See lib/carrierwave/storage/file.rb for an example. Storage engines should be added to CarrierWave::Uploader::Base.storage_engines so they can be referred to by a symbol, which should be more convenient
If no argument is given, it will simply return the currently used storage engine.
The storage engine to use for this uploader
the storage engine to be used with this uploader
storage :file storage CarrierWave::Storage::File storage MyCustomStorageEngine
# File lib/carrierwave/uploader/configuration.rb, line 91 def storage(storage = nil) if storage.is_a?(Symbol) @storage = eval(storage_engines[storage]) elsif storage @storage = storage elsif @storage.nil? # Get the storage from the superclass if there is one @storage = superclass.storage rescue nil end return @storage end