Class: ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper::OptimizedUrlHelper
- Inherits:
-
ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper
- Object
- ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper
- ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper::OptimizedUrlHelper
- Defined in:
- actionpack/lib/action_dispatch/routing/route_set.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#arg_size ⇒ Object
readonly
Returns the value of attribute arg_size.
Instance Method Summary collapse
- #call(t, args) ⇒ Object
-
#initialize(route, options) ⇒ OptimizedUrlHelper
constructor
A new instance of OptimizedUrlHelper.
Methods inherited from ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper
create, #handle_positional_args, optimize_helper?
Constructor Details
#initialize(route, options) ⇒ OptimizedUrlHelper
Returns a new instance of OptimizedUrlHelper.
164 165 166 167 168 169 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 164 def initialize(route, ) super @path_parts = @route.required_parts @arg_size = @path_parts.size @string_route = @route.optimized_path end |
Instance Attribute Details
#arg_size ⇒ Object (readonly)
Returns the value of attribute arg_size
162 163 164 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 162 def arg_size @arg_size end |
Instance Method Details
#call(t, args) ⇒ Object
171 172 173 174 175 176 177 178 179 180 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 171 def call(t, args) if args.size == arg_size && !args.last.is_a?(Hash) && optimize_routes_generation?(t) = @options.dup .merge!(t.) if t.respond_to?(:url_options) [:path] = optimized_helper(args) ActionDispatch::Http::URL.url_for() else super end end |