Class: Mutx::Custom::Params

Inherits:
Object
  • Object
show all
Defined in:
lib/mutx/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 Mutx



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

def initialize
  params = ENV || {}
  @custom_params = if params["mutx_custom_params"]
   JSON.parse(params["mutx_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



29
30
31
# File 'lib/mutx/custom/params.rb', line 29

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

Class Method Details

.getObject



18
19
20
# File 'lib/mutx/custom/params.rb', line 18

def self.get
  self.new
end

Instance Method Details

#all_paramsObject



22
23
24
# File 'lib/mutx/custom/params.rb', line 22

def all_params
  @custom_params
end

#rawObject



26
# File 'lib/mutx/custom/params.rb', line 26

def raw; all_params; end