27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/routing.rb', line 27
def process_destination_path(path, env)
Thread.current['padrino.instance'].instance_eval do
request.route_obj = path.route
@_response_buffer = nil
@route = path.route
@params ||= {}
@params.update(env['router.params'])
@block_params = if match_data = env['router.request'].['router.regex_match']
params_list = match_data.to_a
params_list.shift
@params[:captures] = params_list
params_list
else
env['router.request'].params
end
original_params = @params
parent_layout = @layout
successful = false
begin
filter! :before
(@route.before_filters - settings.filters[:before]).each { |block| instance_eval(&block) }
@layout = path.route.use_layout if path.route.use_layout
@route.custom_conditions.each { |block| pass if block.bind(self).call == false } if @route.custom_conditions
halt_response = catch(:halt) { route_eval { @route.dest[self, @block_params] } }
@_response_buffer = halt_response.is_a?(Array) ? halt_response.last : halt_response
successful = true
halt halt_response
ensure
(@route.after_filters - settings.filters[:after]).each { |block| instance_eval(&block) } if successful
@layout = parent_layout
@params = original_params
end
end
end
|