Class: EndpointFlux::Config::Interceptor
- Inherits:
-
Object
- Object
- EndpointFlux::Config::Interceptor
- Defined in:
- lib/endpoint_flux/config/interceptor.rb
Instance Attribute Summary collapse
-
#handlers ⇒ Object
Returns the value of attribute handlers.
Instance Method Summary collapse
- #add(&block) ⇒ Object
-
#initialize ⇒ Interceptor
constructor
A new instance of Interceptor.
- #run(attrs) ⇒ Object
Constructor Details
#initialize ⇒ Interceptor
Returns a new instance of Interceptor.
6 7 8 |
# File 'lib/endpoint_flux/config/interceptor.rb', line 6 def initialize @handlers = [] end |
Instance Attribute Details
#handlers ⇒ Object
Returns the value of attribute handlers.
4 5 6 |
# File 'lib/endpoint_flux/config/interceptor.rb', line 4 def handlers @handlers end |
Instance Method Details
#add(&block) ⇒ Object
16 17 18 19 20 |
# File 'lib/endpoint_flux/config/interceptor.rb', line 16 def add(&block) raise 'Block not given' unless block_given? handlers << block end |
#run(attrs) ⇒ Object
10 11 12 13 14 |
# File 'lib/endpoint_flux/config/interceptor.rb', line 10 def run(attrs) handlers.each { |handler| handler.call(attrs) } attrs end |