Sha256: a03229aeba1a01e044aab316f84677952e00b5ca17c8f7d53a76047323009bbe

Contents?: true

Size: 744 Bytes

Versions: 8

Compression:

Stored size: 744 Bytes

Contents

module Evvnt
  # Handles configuration for the gem
  class Configuration

    ##
    #
    ENVIRONMENTS = %i[sandbox live].freeze


    ##
    #
    attr_writer :logger

    ##
    #
    attr_writer :debug

    ##
    #
    attr_accessor :api_key

    ##
    #
    attr_accessor :api_secret

    def initialize(&block)
      instance_eval(&block) if block_given?
    end

    ##
    #
    def environment=(value)
      raise ArgumentError unless value.to_sym.in?(ENVIRONMENTS)
      @environment = value
    end

    def environment
      @environment ||= :sandbox
    end

    ##
    #
    def logger
      @logger ||= Logger.new($stdout)
    end

    ##
    #
    def debug
      defined?(@debug) ? @debug : @debug = false
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
evvnt-0.2.6 lib/evvnt/configuration.rb
evvnt-0.2.5 lib/evvnt/configuration.rb
evvnt-0.2.4 lib/evvnt/configuration.rb
evvnt-0.2.3 lib/evvnt/configuration.rb
evvnt-0.2.2 lib/evvnt/configuration.rb
evvnt-0.2.1 lib/evvnt/configuration.rb
evvnt-0.2.0 lib/evvnt/configuration.rb
evvnt-0.1.0 lib/evvnt/configuration.rb