Class: Sprockets::LegacyProcProcessor
- Inherits:
-
Delegator
- Object
- Delegator
- Sprockets::LegacyProcProcessor
- Defined in:
- lib/sprockets/legacy_proc_processor.rb
Overview
Deprecated: Wraps legacy process Procs with new processor call signature.
Will be removed in Sprockets 4.x.
LegacyProcProcessor.new(:compress,
proc { |context, data| data.gsub(...) })
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #call(input) ⇒ Object
-
#initialize(name, proc) ⇒ LegacyProcProcessor
constructor
A new instance of LegacyProcProcessor.
- #name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, proc) ⇒ LegacyProcProcessor
Returns a new instance of LegacyProcProcessor.
12 13 14 15 |
# File 'lib/sprockets/legacy_proc_processor.rb', line 12 def initialize(name, proc) @name = name @proc = proc end |
Instance Method Details
#__getobj__ ⇒ Object
17 18 19 |
# File 'lib/sprockets/legacy_proc_processor.rb', line 17 def __getobj__ @proc end |
#call(input) ⇒ Object
29 30 31 32 33 |
# File 'lib/sprockets/legacy_proc_processor.rb', line 29 def call(input) context = input[:environment].context_class.new(input) data = @proc.call(context, input[:data]) context..merge(data: data) end |
#name ⇒ Object
21 22 23 |
# File 'lib/sprockets/legacy_proc_processor.rb', line 21 def name "Sprockets::LegacyProcProcessor (#{@name})" end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/sprockets/legacy_proc_processor.rb', line 25 def to_s name end |