Sha256: 35bf96b75224ff380e4b6126b022d6e31703b5d8bd53159cc03c3d0ef3d82600

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

module Eventsimple
  class Configuration
    attr_reader :max_concurrency_retries
    attr_writer :metadata_klass
    attr_writer :parent_record_klass
    attr_accessor :retry_reactor_on_record_not_found

    attr_accessor :ui_visible_models

    def initialize
      @dispatchers = []
      @max_concurrency_retries = 2
      @metadata_klass = 'Eventsimple::Metadata'
      @parent_record_klass = 'ApplicationRecord'
      @retry_reactor_on_record_not_found = false

      @ui_visible_models = [] # internal use only
    end

    def max_concurrency_retries=(value)
      unless value.is_a?(Integer) && value.positive?
        raise ArgumentError, 'max_concurrency_retries must be a positive integer'
      end

      @max_concurrency_retries = value
    end

    def dispatchers=(value)
      raise ArgumentError, 'dispatchers must be an array' unless value.is_a?(Array)

      @dispatchers = value
    end

    # rubocop:disable Naming/MemoizedInstanceVariableName
    def dispatchers
      @dispatchers_klass_consts ||= @dispatchers.map(&:constantize)
    end

    def metadata_klass
      @metadata_klass_const ||= @metadata_klass.constantize
    end

    def parent_record_klass
      @parent_record_const ||= @parent_record_klass.constantize
    end
    # rubocop:enable Naming/MemoizedInstanceVariableName
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
eventsimple-1.5.6 lib/eventsimple/configuration.rb
eventsimple-1.5.5 lib/eventsimple/configuration.rb
eventsimple-1.5.4 lib/eventsimple/configuration.rb
eventsimple-1.5.3 lib/eventsimple/configuration.rb
eventsimple-1.4.3 lib/eventsimple/configuration.rb
eventsimple-1.4.2 lib/eventsimple/configuration.rb
eventsimple-1.4.1 lib/eventsimple/configuration.rb
eventsimple-1.4.0 lib/eventsimple/configuration.rb
eventsimple-1.3.3 lib/eventsimple/configuration.rb