Module: Derailleur::HandlerGenerator
- Defined in:
- lib/derailleur/base/handler_generator.rb
Class Method Summary collapse
-
.for(dummy_params = {}, &blk) ⇒ Object
Creates a new subclass of Derailleur::Handler that will create a Derailleur::Context which in turn will evaluate the block.
Class Method Details
.for(dummy_params = {}, &blk) ⇒ Object
Creates a new subclass of Derailleur::Handler that will create a Derailleur::Context which in turn will evaluate the block. The dummy_params parameter is not used, but we need it because it is the interface for Derailleur.Grease (in case you want to use a custom HandlerGenerator)
12 13 14 15 16 17 18 19 20 |
# File 'lib/derailleur/base/handler_generator.rb', line 12 def self.for(dummy_params={}, &blk) handler = Class.new(Derailleur::Handler) handler.send(:define_method, :to_rack_output) do context = Context.new(env, ctx, &blk) context.evaluate! context.result end handler end |