Class: Sprockets::ProcessorUtils::CompositeProcessor

Inherits:
Struct
  • Object
show all
Defined in:
lib/sprockets/processor_utils.rb

Overview

:nodoc:

Constant Summary collapse

SINGULAR =
lambda { |param, input| ProcessorUtils.call_processor param, input }
PLURAL =
lambda { |param, input| ProcessorUtils.call_processors param, input }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#paramObject

Returns the value of attribute param


20
21
22
# File 'lib/sprockets/processor_utils.rb', line 20

def param
  @param
end

#processor_strategyObject

Returns the value of attribute processor_strategy


20
21
22
# File 'lib/sprockets/processor_utils.rb', line 20

def processor_strategy
  @processor_strategy
end

#processorsObject

Returns the value of attribute processors


20
21
22
# File 'lib/sprockets/processor_utils.rb', line 20

def processors
  @processors
end

Class Method Details

.create(processors) ⇒ Object


24
25
26
27
28
29
30
# File 'lib/sprockets/processor_utils.rb', line 24

def self.create(processors)
  if processors.length == 1
    new SINGULAR, processors.first, processors
  else
    new PLURAL, processors, processors
  end
end

Instance Method Details

#cache_keyObject


36
37
38
# File 'lib/sprockets/processor_utils.rb', line 36

def cache_key
  ProcessorUtils.processors_cache_keys(processors)
end

#call(input) ⇒ Object


32
33
34
# File 'lib/sprockets/processor_utils.rb', line 32

def call(input)
  processor_strategy.call param, input
end