Module: Munna::Extensions::Helper

Defined in:
lib/munna/extensions/helper.rb

Class Method Summary collapse

Class Method Details

.normalize_params(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/munna/extensions/helper.rb', line 4

def self.normalize_params(params)
  first_element = params.first
  last_element = params.last

  cache_opts = last_element.is_a?(Hash) ? last_element : Hash.new
  cache_opts[:caller_name] = caller_locations(2,1)[0].label
  if [Symbol, String, Array].include? first_element.class
    cache_opts[:key] = Munna.get_key first_element
  end

  cache_opts
end