Sha256: 3d6541b28f4530566542b377fea853d5383dae9f4ab06f554f01b647401681f9
Contents?: true
Size: 978 Bytes
Versions: 15
Compression:
Stored size: 978 Bytes
Contents
module Jeanine module Routing module Evaluation def route_eval route = find_route if route result = instance_eval(&route[:block]) @response.write(result) else @response.status = 404 end @response.complete! end private def find_route matches = nil route = Jeanine.router[@request.request_method.to_sym].detect do |r| matches = r[:compiled_path].match(@request.path_info) !matches.nil? end return nil if route.nil? return route if route && route[:params].empty? index = 0 while index < matches.captures.size param = route[:params][index] @request.params[param] = matches.captures[index] if index == matches.captures.size @request.params[param].gsub!(@request.format) end index += 1 end route end end end end
Version data entries
15 entries across 15 versions & 1 rubygems