Sha256: 3f6611d97a95a28535b613f1320d65e0e8eee6c4a5b90ffe0c8e104ec3a58118

Contents?: true

Size: 686 Bytes

Versions: 12

Compression:

Stored size: 686 Bytes

Contents

module Loquor
  class LoquorError < StandardError
  end
  class LoquorConfigurationError < LoquorError
  end

  class Configuration

    SETTINGS = [
      :logger, :access_id, :secret_key, :endpoint
    ]

    attr_writer *SETTINGS

    def initialize
      Filum.config do |config|
        config.logfile = "./log/loquor.log"
      end
      logger = Filum.logger
    end

    SETTINGS.each do |setting|
      define_method setting do
        get_or_raise(setting)
      end
    end

    private

    def get_or_raise(setting)
      instance_variable_get("@#{setting.to_s}") ||
        raise(LoquorConfigurationError.new("Configuration for #{setting} is not set"))
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
loquor-0.5.3 lib/loquor/configuration.rb
loquor-0.5.2 lib/loquor/configuration.rb
loquor-0.5.1 lib/loquor/configuration.rb
loquor-0.5.0 lib/loquor/configuration.rb
loquor-0.4.0 lib/loquor/configuration.rb
loquor-0.3.0 lib/loquor/configuration.rb
loquor-0.2.0 lib/loquor/configuration.rb
loquor-0.1.2 lib/loquor/configuration.rb
loquor-0.1.1 lib/loquor/configuration.rb
loquor-0.1.0 lib/loquor/configuration.rb
loquor-0.0.2 lib/loquor/configuration.rb
loquor-0.0.1 lib/loquor/configuration.rb