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:
- lib/action_dispatch/routing/route_set.rb
Instance Attribute Summary collapse
-
#arg_size ⇒ Object
readonly
Returns the value of attribute arg_size.
Attributes inherited from ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper
Instance Method Summary collapse
- #call(t, args, inner_options) ⇒ Object
-
#initialize(route, options, route_name, url_strategy) ⇒ 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, route_name, url_strategy) ⇒ OptimizedUrlHelper
Returns a new instance of OptimizedUrlHelper.
165 166 167 168 169 |
# File 'lib/action_dispatch/routing/route_set.rb', line 165 def initialize(route, , route_name, url_strategy) super @required_parts = @route.required_parts @arg_size = @required_parts.size end |
Instance Attribute Details
#arg_size ⇒ Object (readonly)
Returns the value of attribute arg_size.
163 164 165 |
# File 'lib/action_dispatch/routing/route_set.rb', line 163 def arg_size @arg_size end |
Instance Method Details
#call(t, args, inner_options) ⇒ Object
171 172 173 174 175 176 177 178 179 |
# File 'lib/action_dispatch/routing/route_set.rb', line 171 def call(t, args, ) if args.size == arg_size && ! && optimize_routes_generation?(t) = t..merge @options [:path] = optimized_helper(args) url_strategy.call else super end end |