Class: RoutingFilter::Filter
- Inherits:
-
Object
- Object
- RoutingFilter::Filter
- Defined in:
- lib/routing_filter/filter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#next ⇒ Object
Returns the value of attribute next.
-
#options ⇒ Object
Returns the value of attribute options.
-
#previous ⇒ Object
Returns the value of attribute previous.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Filter
constructor
A new instance of Filter.
- #run(method, *args, &block) ⇒ Object
- #run_reverse(method, *args, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Filter
Returns a new instance of Filter.
5 6 7 |
# File 'lib/routing_filter/filter.rb', line 5 def initialize( = {}) @options = end |
Instance Attribute Details
#next ⇒ Object
Returns the value of attribute next.
3 4 5 |
# File 'lib/routing_filter/filter.rb', line 3 def next @next end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/routing_filter/filter.rb', line 3 def @options end |
#previous ⇒ Object
Returns the value of attribute previous.
3 4 5 |
# File 'lib/routing_filter/filter.rb', line 3 def previous @previous end |
Instance Method Details
#run(method, *args, &block) ⇒ Object
9 10 11 12 |
# File 'lib/routing_filter/filter.rb', line 9 def run(method, *args, &block) _next = self.next ? proc {|path, env| self.next.run(method, *args, &block) } : block RoutingFilter.active? ? send(method, *args, &_next) : _next.call(*args) end |
#run_reverse(method, *args, &block) ⇒ Object
14 15 16 17 |
# File 'lib/routing_filter/filter.rb', line 14 def run_reverse(method, *args, &block) _prev = previous ? lambda { previous.run_reverse(method, *args, &block) } : block RoutingFilter.active? ? send(method, *args, &_prev) : _prev.call(*args) end |