lib/jellyfish/multi_actions.rb in jellyfish-0.8.0 vs lib/jellyfish/multi_actions.rb in jellyfish-0.9.0
- old
+ new
@@ -3,17 +3,13 @@
module Jellyfish
module MultiActions
- Identity = lambda{|_|_}
-
def call env
@env = env
- catch(:halt){
- dispatch.inject(nil){ |_, route_block| block_call(*route_block) }
- } || block_call(nil, Identity) # respond the default if halted
+ dispatch.inject(nil){ |_, route_block| block_call(*route_block) }
end
def dispatch
acts = actions.map{ |(route, block)|
case route
@@ -24,10 +20,10 @@
[match, block] if match
end
}.compact
if acts.empty?
- raise(Jellyfish::NotFound.new)
+ halt(Jellyfish::NotFound.new)
else
acts
end
end
end