Sha256: 5ec1e0be2cf3ed392dea42f80c64354a3864743ffe147d092d88ae21c3c2aeea

Contents?: true

Size: 997 Bytes

Versions: 8

Compression:

Stored size: 997 Bytes

Contents

# frozen_string_literal: true

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

8 entries across 8 versions & 1 rubygems

Version Path
hermes_messenger_of_the_gods-3.0.0 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-3.0.0.rc5 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-3.0.0.rc4 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-3.0.0.rc3 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-3.0.0.rc2 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-3.0.0.rc1 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-2.4.2 lib/hermes_messenger_of_the_gods/configuration.rb
hermes_messenger_of_the_gods-2.4.1 lib/hermes_messenger_of_the_gods/configuration.rb