Class: CarrierWave::Processor::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/carrierwave/processor/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#backend(name = nil, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/carrierwave/processor/configuration.rb', line 29

def backend name=nil, options={}
  if name
    backends_path = (::CarrierWave::Processor.root + 'carrierwave/processor/backend')
    backend_file = backends_path.entries.detect{|i| i.basename('.rb').to_s == name.to_s}
    raise BackendNotFound.new(name) unless backend_file
    backend_file = backends_path + backend_file
    require backend_file
    raise BackendNotFound.new(name) unless backend_file
    begin
      klass = ::CarrierWave::Processor::Backend.const_get(name.to_s.classify.to_sym)
    rescue NameError
      raise BackendNotFound.new(name)
    end
    options = @backend.options.merge(options) if @backend
    @backend = klass.new options
  elsif @backend
    @backend
  else
    raise BackendNotInitializedError.new
  end
end

Instance Method Details

#backend_configured?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/carrierwave/processor/configuration.rb', line 25

def backend_configured?
  @backend.present?
end

#delayObject



21
22
23
# File 'lib/carrierwave/processor/configuration.rb', line 21

def delay
  self
end