Class: Spank::InterceptorChain
- Inherits:
-
Object
- Object
- Spank::InterceptorChain
- Defined in:
- lib/spank/interceptor_chain.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(interceptors = []) ⇒ InterceptorChain
constructor
A new instance of InterceptorChain.
- #intercept(invocation) ⇒ Object
- #push(interceptor) ⇒ Object
Constructor Details
#initialize(interceptors = []) ⇒ InterceptorChain
3 4 5 |
# File 'lib/spank/interceptor_chain.rb', line 3 def initialize(interceptors = []) @interceptors = interceptors end |
Instance Method Details
#each(&block) ⇒ Object
11 12 13 |
# File 'lib/spank/interceptor_chain.rb', line 11 def each(&block) @interceptors.each(&block) end |
#intercept(invocation) ⇒ Object
15 16 17 18 19 |
# File 'lib/spank/interceptor_chain.rb', line 15 def intercept(invocation) each do |interceptor| interceptor.intercept(invocation) end end |
#push(interceptor) ⇒ Object
7 8 9 |
# File 'lib/spank/interceptor_chain.rb', line 7 def push(interceptor) @interceptors.push(interceptor) end |