class ActionDispatch::Routing::DirectRoutes::RouteSet::CustomUrlHelper
Attributes
block[R]
defaults[R]
name[R]
Public Class Methods
new(name, defaults, &block)
click to toggle source
# File lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb, line 10 def initialize(name, defaults, &block) @name = name @defaults = defaults @block = block end
Public Instance Methods
call(t, args, only_path = false)
click to toggle source
# File lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb, line 16 def call(t, args, only_path = false) options = args.extract_options! url = t.full_url_for(eval_block(t, args, options)) if only_path "/" + url.partition(%r{(?<!/)/(?!/)}).last else url end end
Private Instance Methods
eval_block(t, args, options)
click to toggle source
# File lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb, line 28 def eval_block(t, args, options) t.instance_exec(*args, merge_defaults(options), &block) end
merge_defaults(options)
click to toggle source
# File lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb, line 32 def merge_defaults(options) defaults ? defaults.merge(options) : options end