Sha256: e96ab071c1c41e13cec5cfeecd7bb7b54108f741f8a112a8d2c0b2a1dfa287d3

Contents?: true

Size: 706 Bytes

Versions: 4

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

module Coactive
  class Config
    DEFAULTS = {
      base_class: nil,
      load_paths: ['app/coactors'],
      class_suffix: 'Coactor',
      use_cache: true,
      lookup_superclass_for_object: true,
      lookup_superclass_until: ['ActiveRecord::Base', 'ActiveModel::Base'],
      default_priority: 1 << 63
    }

    attr_accessor :data

    def initialize(attrs = {})
      @data = DEFAULTS.deep_dup
      attrs.each do |key, value|
        send("#{key}=", value)
      end
    end

    DEFAULTS.keys.each do |key|
      define_method "#{key}" do
        @data[key]
      end

      define_method "#{key}=" do |val|
        @data[key] = val
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coactive-0.6.0 lib/coactive/config.rb
coactive-0.5.2 lib/coactive/config.rb
coactive-0.5.1 lib/coactive/config.rb
coactive-0.5.0 lib/coactive/config.rb