Sha256: cf455f130728ae1f46926bb0bee43cb2328d2db297ce50667c2c9aa4f86daba4

Contents?: true

Size: 677 Bytes

Versions: 73

Compression:

Stored size: 677 Bytes

Contents

# encoding: utf-8
module Mutx
  module Custom
    class Params

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

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

      def self.get
        self.new
      end

      def all_params
        @custom_params
      end

      def raw; all_params; end

      # All custom params can be called as methods
      def method_missing(param, *args, &block)
        @custom_params[param.to_s]
      end

    end
  end
end

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
mutx-0.2.9 lib/mutx/custom/params.rb
mutx-0.2.8 lib/mutx/custom/params.rb
mutx-0.2.7 lib/mutx/custom/params.rb
mutx-0.2.6 lib/mutx/custom/params.rb
mutx-0.2.5 lib/mutx/custom/params.rb
mutx-0.2.4 lib/mutx/custom/params.rb
mutx-0.2.3 lib/mutx/custom/params.rb
mutx-0.2.2 lib/mutx/custom/params.rb
mutx-0.2.1 lib/mutx/custom/params.rb
mutx-0.2.0 lib/mutx/custom/params.rb
mutx-0.1.69 lib/mutx/custom/params.rb
mutx-0.1.68 lib/mutx/custom/params.rb
mutx-0.1.67 lib/mutx/custom/params.rb
mutx-0.1.66 lib/mutx/custom/params.rb
mutx-0.1.65 lib/mutx/custom/params.rb
mutx-0.1.64 lib/mutx/custom/params.rb
mutx-0.1.63 lib/mutx/custom/params.rb
mutx-0.1.62 lib/mutx/custom/params.rb
mutx-0.1.61 lib/mutx/custom/params.rb
mutx-0.1.60 lib/mutx/custom/params.rb