class ParamsKeeper::UrlFor

Public Class Methods

new(caller, controller, url_options) click to toggle source
# File lib/params_keeper/url_for.rb, line 3
def initialize(caller, controller, url_options)
  @caller = caller
  @controller = controller
  @url_options = url_options
end

Public Instance Methods

call() click to toggle source
# File lib/params_keeper/url_for.rb, line 9
def call
  return if @controller.class.keep_params_configs.blank?

  resolver = ParamsKeeper::Resolver.new(@controller, @url_options)
  params = resolver.call
  return if params.blank?

  base_url_for(resolver.url_options_hash.reverse_merge(params))
end

Private Instance Methods

base_url_for(url_options) click to toggle source
# File lib/params_keeper/url_for.rb, line 21
def base_url_for(url_options)
  @caller.method(:url_for).super_method.call(url_options)
end