Class: Mutx::Custom::Params
- Inherits:
-
Object
- Object
- Mutx::Custom::Params
- Defined in:
- lib/mutx/custom/params.rb
Class Method Summary collapse
Instance Method Summary collapse
- #all_params ⇒ Object
-
#initialize ⇒ Params
constructor
This class is used to provide to user in his code access to the custom params sent from Mutx.
-
#method_missing(param, *args, &block) ⇒ Object
All custom params can be called as methods.
- #raw ⇒ Object
Constructor Details
#initialize ⇒ Params
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
.get ⇒ Object
18 19 20 |
# File 'lib/mutx/custom/params.rb', line 18 def self.get self.new end |
Instance Method Details
#all_params ⇒ Object
22 23 24 |
# File 'lib/mutx/custom/params.rb', line 22 def all_params @custom_params end |
#raw ⇒ Object
26 |
# File 'lib/mutx/custom/params.rb', line 26 def raw; all_params; end |