Sha256: 6644406da5a365658ee1535d0200e9200efcdbe01e621162f29e100084388895

Contents?: true

Size: 659 Bytes

Versions: 14

Compression:

Stored size: 659 Bytes

Contents

module Kaya
  module Custom
    class Params

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

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

14 entries across 14 versions & 1 rubygems

Version Path
kaya-0.0.14 lib/kaya/custom/params.rb
kaya-0.0.13 lib/kaya/custom/params.rb
kaya-0.0.12 lib/kaya/custom/params.rb
kaya-0.0.11 lib/kaya/custom/params.rb
kaya-0.0.10 lib/kaya/custom/params.rb
kaya-0.0.9 lib/kaya/custom/params.rb
kaya-0.0.8 lib/kaya/custom/params.rb
kaya-0.0.7 lib/kaya/custom/params.rb
kaya-0.0.6 lib/kaya/custom/params.rb
kaya-0.0.5 lib/kaya/custom/params.rb
kaya-0.0.4 lib/kaya/custom/params.rb
kaya-0.0.3 lib/kaya/custom/params.rb
kaya-0.0.2 lib/kaya/custom/params.rb
kaya-0.0.1 lib/kaya/custom/params.rb