Sha256: 6e6870c57670321f9c0343b4e72f37e2d45c5052169694e47870709b668963be
Contents?: true
Size: 589 Bytes
Versions: 4
Compression:
Stored size: 589 Bytes
Contents
require 'jellyfish' module Jellyfish module MultiActions def call env @env = env dispatch.inject(nil){ |_, route_block| block_call(*route_block) } end def dispatch acts = actions.map{ |(route, block)| case route when String [route, block] if route == path_info else#Regexp, using else allows you to use custom matcher match = route.match(path_info) [match, block] if match end }.compact if acts.empty? action_missing else acts end end end end
Version data entries
4 entries across 4 versions & 2 rubygems