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.1.18 lib/mutx/custom/params.rb
mutx-0.1.17 lib/mutx/custom/params.rb
mutx-0.1.16 lib/mutx/custom/params.rb
mutx-0.1.15 lib/mutx/custom/params.rb
mutx-0.1.14 lib/mutx/custom/params.rb
mutx-0.1.13 lib/mutx/custom/params.rb
mutx-0.1.12 lib/mutx/custom/params.rb
mutx-0.1.11 lib/mutx/custom/params.rb
mutx-0.1.10 lib/mutx/custom/params.rb
mutx-0.1.9 lib/mutx/custom/params.rb
mutx-0.1.8 lib/mutx/custom/params.rb
mutx-0.1.7 lib/mutx/custom/params.rb
mutx-0.1.6 lib/mutx/custom/params.rb