Class: Kaya::Custom::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/kaya/custom/params.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeParams

This class is used to provide to user in his code access to the custom params sent from Kaya



8
9
10
11
12
13
14
15
# File 'lib/kaya/custom/params.rb', line 8

def initialize
  params = ENV || {}
  @custom_params = if params["kaya_custom_params"]
   JSON.parse(params["kaya_custom_params"])
  else
    params
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(param, *args, &block) ⇒ Object

All custom params can be called as methods



28
29
30
# File 'lib/kaya/custom/params.rb', line 28

def method_missing(param, *args, &block)
  @custom_params[param.to_s]
end

Class Method Details

.getObject



17
18
19
# File 'lib/kaya/custom/params.rb', line 17

def self.get
  self.new
end

Instance Method Details

#all_paramsObject



21
22
23
# File 'lib/kaya/custom/params.rb', line 21

def all_params
  @custom_params
end

#rawObject



25
# File 'lib/kaya/custom/params.rb', line 25

def raw; all_params; end