Class: ActionDispatch::Routing::OptionRedirect
- Defined in:
- lib/action_dispatch/routing/redirection.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Redirect
Instance Method Summary collapse
Methods inherited from Redirect
#build_response, #call, #initialize, #redirect?
Methods inherited from Endpoint
#app, #dispatcher?, #engine?, #matches?, #rack_app, #redirect?
Constructor Details
This class inherits a constructor from ActionDispatch::Routing::Redirect
Instance Method Details
#inspect ⇒ Object
143 144 145 |
# File 'lib/action_dispatch/routing/redirection.rb', line 143 def inspect "redirect(#{status}, #{.map { |k, v| "#{k}: #{v}" }.join(', ')})" end |
#path(params, request) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/action_dispatch/routing/redirection.rb', line 117 def path(params, request) = { protocol: request.protocol, host: request.host, port: request.optional_port, path: request.path, params: request.query_parameters }.merge! if !params.empty? && [:path].match(/%\{\w*\}/) [:path] = ([:path] % escape_path(params)) end unless [:host] || [:domain] if relative_path?([:path]) [:path] = "/#{[:path]}" [:script_name] = request.script_name elsif [:path].empty? [:path] = request.script_name.empty? ? "/" : "" [:script_name] = request.script_name end end ActionDispatch::Http::URL.url_for end |