Sha256: 06a167f905b2cb3347b71cd62a7fb41c151d38d03b58f261c254588897ceaaad

Contents?: true

Size: 894 Bytes

Versions: 6

Compression:

Stored size: 894 Bytes

Contents

#
# Configuration object for storing some parameters required for making transactions
#
module Dagjeweg::Config
  class << self
    # @return [String] Your Dagjeweg API Key
    # @note The is a required parameter.
    attr_accessor :api_key


    # Set's the default value's to nil and false
    # @return [Hash] configuration options
    def init!
      @defaults = {
        :@api_key   => nil,
      }
    end

    # Resets the value's to there previous value (instance_variable)
    # @return [Hash] configuration options
    def reset!
      @defaults.each { |key, value| instance_variable_set(key, value) }
    end

    # Set's the new value's as instance variables
    # @return [Hash] configuration options
    def update!
      @defaults.each do |key, value|
        instance_variable_set(key, value) unless instance_variable_defined?(key)
      end
    end
  end
  init!
  reset!
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dagjeweg-0.0.8 lib/dagjeweg/config.rb
dagjeweg-0.0.7 lib/dagjeweg/config.rb
dagjeweg-0.0.6 lib/dagjeweg/config.rb
dagjeweg-0.0.5 lib/dagjeweg/config.rb
dagjeweg-0.0.4 lib/dagjeweg/config.rb
dagjeweg-0.0.2 lib/dagjeweg/config.rb