Class: Sprockets::Processor
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Sprockets::Processor
- Defined in:
- lib/sprockets/processor.rb
Overview
‘Processor` creates an anonymous processor class from a block.
register_preprocessor :my_processor do |context, data|
# ...
end
Class Method Summary collapse
- .name ⇒ Object
-
.processor ⇒ Object
‘processor` is a lambda or block.
- .to_s ⇒ Object
Instance Method Summary collapse
-
#evaluate(context, locals) ⇒ Object
Call processor block with ‘context` and `data`.
- #prepare ⇒ Object
Class Method Details
.name ⇒ Object
16 17 18 |
# File 'lib/sprockets/processor.rb', line 16 def self.name "Sprockets::Processor (#{@name})" end |
.processor ⇒ Object
‘processor` is a lambda or block
12 13 14 |
# File 'lib/sprockets/processor.rb', line 12 def self.processor @processor end |
.to_s ⇒ Object
20 21 22 |
# File 'lib/sprockets/processor.rb', line 20 def self.to_s name end |
Instance Method Details
#evaluate(context, locals) ⇒ Object
Call processor block with ‘context` and `data`.
28 29 30 |
# File 'lib/sprockets/processor.rb', line 28 def evaluate(context, locals) self.class.processor.call(context, data) end |
#prepare ⇒ Object
24 25 |
# File 'lib/sprockets/processor.rb', line 24 def prepare end |