Class: DhEasy::Router::Finisher
- Inherits:
-
Object
- Object
- DhEasy::Router::Finisher
- Includes:
- Plugin::Router
- Defined in:
- lib/dh_easy/router/finisher.rb
Overview
Finisher router designed to execute all finisher classes.
Instance Attribute Summary
Attributes included from Plugin::Router
Instance Method Summary collapse
-
#route(opts = {}) ⇒ Object
Execute the finisher class with options as described by router configuration and calling class’s instance ‘finish` method.
Methods included from Plugin::Router
#class_defined?, #config, #get_class, #initialize, #initialize_hook_router_plugin_router
Instance Method Details
#route(opts = {}) ⇒ Object
Note:
Requires the route class to implement ‘finish` instance method.
Execute the finisher class with options as described by router
configuration and calling class's instance `finish` method.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dh_easy/router/finisher.rb', line 19 def route opts = {} context = opts[:context] if opts[:context].nil? raise ArgumentError.new('Must send a context to the finisher.') end class_name = nil config['finisher']['routes'].each do |item| # Validate class name executor_class = get_class item['class'] if executor_class.nil? raise NameError.new("Class \"#{item['class']}\" doesn't exists, check your ae_easy config file.") end executor_class.new(opts).finish end end |