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.
166 167 168 169 170 171 172 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 166 def initialize(route, ) super @klass = Journey::Router::Utils @required_parts = @route.required_parts @arg_size = @required_parts.size @optimized_path = @route.optimized_path end |
Instance Attribute Details
#arg_size ⇒ Object (readonly)
Returns the value of attribute arg_size
164 165 166 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 164 def arg_size @arg_size end |
Instance Method Details
#call(t, args) ⇒ Object
174 175 176 177 178 179 180 181 182 183 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 174 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 |