Class: ApiValve::Cascade
- Inherits:
-
Object
- Object
- ApiValve::Cascade
- Defined in:
- lib/api_valve/cascade.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(*proxies) ⇒ Cascade
constructor
A new instance of Cascade.
Constructor Details
#initialize(*proxies) ⇒ Cascade
Returns a new instance of Cascade.
3 4 5 |
# File 'lib/api_valve/cascade.rb', line 3 def initialize(*proxies) @proxies = Array.wrap(proxies).flatten end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/api_valve/cascade.rb', line 7 def call(env) @proxies.each do |proxy| return proxy.call env rescue Error::NotRouted next end render_error Error::NotFound.new end |