Method: Spider::Controller.before
- Defined in:
- lib/spiderfw/controller/controller.rb
.before(conditions, method, params = {}) ⇒ void
This method returns an undefined value.
Defines a method that will be called before the controller’s before, if the action matches the given conditions. Example:
before(/^list_/, :before_lists)
will call the method before_lists if the action starts with ‘list_’
57 58 59 60 61 |
# File 'lib/spiderfw/controller/controller.rb', line 57 def before(conditions, method, params={}) @dispatch_methods ||= {} @dispatch_methods[:before] ||= [] @dispatch_methods[:before] << [conditions, method, params] end |