Class: RoutingFilter::Base
- Inherits:
-
Object
- Object
- RoutingFilter::Base
show all
- Defined in:
- lib/routing_filter/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
8
9
10
11
|
# File 'lib/routing_filter/base.rb', line 8
def initialize(options = {})
@options = options
options.each { |name, value| instance_variable_set :"@#{name}", value }
end
|
Instance Attribute Details
#chain ⇒ Object
Returns the value of attribute chain.
6
7
8
|
# File 'lib/routing_filter/base.rb', line 6
def chain
@chain
end
|
#options ⇒ Object
Returns the value of attribute options.
6
7
8
|
# File 'lib/routing_filter/base.rb', line 6
def options
@options
end
|
Instance Method Details
#predecessor ⇒ Object
23
24
25
|
# File 'lib/routing_filter/base.rb', line 23
def predecessor
@chain.predecessor(self)
end
|
#run(method, *args, &block) ⇒ Object
13
14
15
16
|
# File 'lib/routing_filter/base.rb', line 13
def run(method, *args, &block)
_next = successor ? lambda { successor.run(method, *args, &block) } : block
active ? send(method, *args, &_next) : _next.call(*args)
end
|
#run_reverse(method, *args, &block) ⇒ Object
18
19
20
21
|
# File 'lib/routing_filter/base.rb', line 18
def run_reverse(method, *args, &block)
_prev = predecessor ? lambda { predecessor.run(method, *args, &block) } : block
active ? send(method, *args, &_prev) : _prev.call(*args)
end
|
#successor ⇒ Object
27
28
29
|
# File 'lib/routing_filter/base.rb', line 27
def successor
@chain.successor(self)
end
|