Class: ParamsKeeper::UrlFor

Inherits:
Object
  • Object
show all
Defined in:
lib/params_keeper/url_for.rb

Instance Method Summary collapse

Constructor Details

#initialize(caller, controller, url_options) ⇒ UrlFor

Returns a new instance of UrlFor.



5
6
7
8
9
# File 'lib/params_keeper/url_for.rb', line 5

def initialize(caller, controller, url_options)
  @caller = caller
  @controller = controller
  @url_options = url_options
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
# File 'lib/params_keeper/url_for.rb', line 11

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