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.38 lib/mutx/custom/params.rb
mutx-0.1.37 lib/mutx/custom/params.rb
mutx-0.1.36 lib/mutx/custom/params.rb
mutx-0.1.35 lib/mutx/custom/params.rb
mutx-0.1.34 lib/mutx/custom/params.rb
mutx-0.1.33 lib/mutx/custom/params.rb
mutx-0.1.32 lib/mutx/custom/params.rb
mutx-0.1.31 lib/mutx/custom/params.rb
mutx-0.1.30 lib/mutx/custom/params.rb
mutx-0.1.29 lib/mutx/custom/params.rb
mutx-0.1.28 lib/mutx/custom/params.rb
mutx-0.1.27 lib/mutx/custom/params.rb
mutx-0.1.26 lib/mutx/custom/params.rb
mutx-0.1.25 lib/mutx/custom/params.rb
mutx-0.1.24 lib/mutx/custom/params.rb
mutx-0.1.23 lib/mutx/custom/params.rb
mutx-0.1.22 lib/mutx/custom/params.rb
mutx-0.1.21 lib/mutx/custom/params.rb
mutx-0.1.20 lib/mutx/custom/params.rb
mutx-0.1.19 lib/mutx/custom/params.rb