Sha256: 20e10a6d7272b7a83b346b0acae34caebde8eae1646f044c457099224f090ec1

Contents?: true

Size: 967 Bytes

Versions: 5

Compression:

Stored size: 967 Bytes

Contents

require 'logger'

module HermesMessengerOfTheGods
  class Configuration
    class << self
      def attr_accessor_with_default(meth, default)
        attr_writer meth

        define_method(meth) do
          if instance_variable_defined?("@#{meth}")
            instance_variable_get("@#{meth}")
          else
            instance_variable_set("@#{meth}", default.respond_to?(:call) ? default.call() : default)
          end
        end
      end
    end

    # Log location for HMOTG info messages. Should respond like your
    # typical Ruby Logger defaults to logging via STDOUT
    attr_accessor_with_default :logger, Logger.new(STDOUT)

    attr_accessor_with_default :quiet, false

    attr_accessor_with_default :stub_dispatch, false

    attr_accessor_with_default :kill_on_consecutive_failures, false

    attr_accessor_with_default :sqs_client, -> { Aws::SQS::Client.new }
    attr_accessor_with_default :sns_client, -> { Aws::SNS::Client.new }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hermes_messenger_of_the_gods-2.4.0.pre2 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-2.4.0.pre1 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-2.3.4 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-2.3.3 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-2.3.2 lib/hermes_messenger_of_the_gods/configuration.rb