Class: EndpointFlux::Config::Interceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/endpoint_flux/config/interceptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInterceptor

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

#handlersObject

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