Class: RoutingFilter::Chain
- Inherits:
-
Array
- Object
- Array
- RoutingFilter::Chain
- Defined in:
- lib/routing_filter/chain.rb
Instance Method Summary collapse
- #<<(filter) ⇒ Object (also: #push)
- #active? ⇒ Boolean
- #run(method, *args, &final) ⇒ Object
- #unshift(filter) ⇒ Object
Instance Method Details
#<<(filter) ⇒ Object Also known as: push
3 4 5 6 |
# File 'lib/routing_filter/chain.rb', line 3 def <<(filter) filter.previous, last.next = last, filter if last super end |
#active? ⇒ Boolean
18 19 20 |
# File 'lib/routing_filter/chain.rb', line 18 def active? RoutingFilter.active? && !empty? end |
#run(method, *args, &final) ⇒ Object
14 15 16 |
# File 'lib/routing_filter/chain.rb', line 14 def run(method, *args, &final) active? ? first.run(method, *args, &final) : final.call end |
#unshift(filter) ⇒ Object
9 10 11 12 |
# File 'lib/routing_filter/chain.rb', line 9 def unshift(filter) filter.next, first.previous = first, filter if first super end |