class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/action_dispatch/routing/route_set.rbs class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper def self.optimize_helper?: (ActionDispatch::Journey::Route route) -> true type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_call_t = #<Class:0x0000000107216eb8> | #<Class:0x000000010dc1f968> | Module | #<Class:0x000000010e45de90> | #<Class:0x00000001127ffa18> | #<Class:0x00000001110dbff8> | #<Class:0x000000010fb3b5e0> | #<Class:0x0000000112c956e0> | #<Class:0x000000010fed9bc0> | #<Class:0x000000010fd1fb40> | #<Class:0x00000001075997e8> | #<Class:0x0000000108d7e610> | #<Class:0x000000010e08b060> | #<Class:0x0000000110baf520> | Gems::Wrapper | #<Class:0x0000000111ef41a8> | #<Class:0x0000000116f10f10> | #<Class:0x0000000116fdeb18> | #<Class:0x000000010e19a320> | #<Class:0x0000000115f34060> | #<Class:0x0000000115e3ebb0> | #<Class:0x000000010cf2d160> | #<Class:0x000000010b0bb560> | #<Class:0x000000010667b9a0> def call: (ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_call_t t, Symbol method_name, Array[String] args, nil inner_options, Proc url_strategy) -> String def handle_positional_args: (Hash controller_options, Hash inner_options, Array[String] args, Hash result, Array[Symbol] path_params) -> Hash end
def self.create(route, options, route_name)
def self.create(route, options, route_name) if optimize_helper?(route) OptimizedUrlHelper.new(route, options, route_name) else new(route, options, route_name) end end
def self.optimize_helper?(route)
Experimental RBS support (using type sampling data from the type_fusion
project).
def self.optimize_helper?: (ActionDispatch::Journey::Route route) -> true
This signature was generated using 2 samples from 1 application.
def self.optimize_helper?(route) route.path.requirements.empty? && !route.glob? end
def call(t, method_name, args, inner_options, url_strategy)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_call_t = #<Class:0x0000000107216eb8> | #<Class:0x000000010dc1f968> | Module | #<Class:0x000000010e45de90> | #<Class:0x00000001127ffa18> | #<Class:0x00000001110dbff8> | #<Class:0x000000010fb3b5e0> | #<Class:0x0000000112c956e0> | #<Class:0x000000010fed9bc0> | #<Class:0x000000010fd1fb40> | #<Class:0x00000001075997e8> | #<Class:0x0000000108d7e610> | #<Class:0x000000010e08b060> | #<Class:0x0000000110baf520> | Gems::Wrapper | #<Class:0x0000000111ef41a8> | #<Class:0x0000000116f10f10> | #<Class:0x0000000116fdeb18> | #<Class:0x000000010e19a320> | #<Class:0x0000000115f34060> | #<Class:0x0000000115e3ebb0> | #<Class:0x000000010cf2d160> | #<Class:0x000000010b0bb560> | #<Class:0x000000010667b9a0> type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_call_args = String | String | String | String | String | String | Gem::Version | String | ModuleDefinition def call: (ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_call_t t, Symbol method_name, ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_call_args args, nil inner_options, Proc url_strategy) -> String
This signature was generated using 63 samples from 1 application.
def call(t, method_name, args, inner_options, url_strategy) controller_options = t.url_options options = controller_options.merge @options hash = handle_positional_args(controller_options, inner_options || {}, args, options, @segment_keys) t._routes.url_for(hash, route_name, url_strategy, method_name) end
def handle_positional_args(controller_options, inner_options, args, result, path_params)
Experimental RBS support (using type sampling data from the type_fusion
project).
type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_controller_options = | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | script_name | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | script_name | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | file | String | script_name | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | guide | String | format | String | script_name | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | script_name | String | host | String | port | Integer | protocol | String | _recall | id | String | controller | String | action | String | gem | String | version | String | script_name | String type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_args = String | String | String | String | String | String | String | ModuleDefinition | Gem::Version type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_result = controller | String | action | String | controller | String | action | String | gem | String | version | String | class | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | script_name | String | controller | String | action | String | gem | String | version | String | controller | String | action | String | gem | String | version | String | class | String | name | String | controller | String | action | String | gem | String | version | String | module | String | name | String | controller | String | action | String | gem | String | version | String | module | ModuleDefinition | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | script_name | String | controller | String | action | String | gem | String | version | Gem::Version | controller | String | action | String | gem | String | version | String | file | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | script_name | String | controller | String | action | String | gem | String | version | String | guide | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | script_name | String | controller | String | action | String | gem | String | version | String | class | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | file | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | guide | String | format | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | script_name | String | controller | String | action | String | gem | String | version | String | guide | String | host | String | port | Integer | protocol | String | _recall | id | String | controller | String | action | String | gem | String | version | String | script_name | String | controller | String | action | String | gem | String | version | String | id | String | controller | String | action | String | gem | String | version | String | id | String | controller | String | action | String | gem | String | version | String | class_id | String | id | String | controller | String | action | String | gem | String | version | String | module_id | String | id | String type ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_return_value = host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | file | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | version | String | guide | String | format | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | script_name | String | controller | String | action | String | gem | String | version | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | gem | String | script_name | String | controller | String | action | String | gem | String | version | String | guide | String | host | String | port | Integer | protocol | String | _recall | id | String | controller | String | action | String | gem | String | version | String | script_name | String | controller | String | action | String | gem | String | version | String | id | String | controller | String | action | String | gem | String | version | String | id | String | host | String | port | Integer | protocol | String | _recall | controller | String | action | String | script_name | String | controller | String | action | String | gem | String | version | Gem::Version | controller | String | action | String | gem | String | version | String | class_id | String | id | String | controller | String | action | String | gem | String | version | String | module_id | String | id | String def handle_positional_args: (ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_controller_options controller_options, inner_options, ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_args args, ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_result result, (Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol) path_params) -> ActionDispatch__Routing__RouteSet__NamedRouteCollection__UrlHelper_handle_positional_args_return_value
This signature was generated using 75 samples from 1 application.
def handle_positional_args(controller_options, inner_options, args, result, path_params) if args.size > 0 # take format into account if path_params.include?(:format) path_params_size = path_params.size - 1 else path_params_size = path_params.size end if args.size < path_params_size path_params -= controller_options.keys path_params -= result.keys else path_params = path_params.dup end inner_options.each_key do |key| path_params.delete(key) end args.each_with_index do |arg, index| param = path_params[index] result[param] = arg if param end end result.merge!(inner_options) end
def initialize(route, options, route_name)
def initialize(route, options, route_name) @options = options @segment_keys = route.segment_keys.uniq @route = route @route_name = route_name end