Sha256: 5256ef8893a4fb9194714c33e8ff7bc14f5d9055d167376aa805becdf463eebe

Contents?: true

Size: 674 Bytes

Versions: 8

Compression:

Stored size: 674 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'],
    }

    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

8 entries across 8 versions & 1 rubygems

Version Path
coactive-0.4.1 lib/coactive/config.rb
coactive-0.4.0 lib/coactive/config.rb
coactive-0.3.0 lib/coactive/config.rb
coactive-0.2.2 lib/coactive/config.rb
coactive-0.2.1 lib/coactive/config.rb
coactive-0.2.0 lib/coactive/config.rb
coactive-0.1.2 lib/coactive/config.rb
coactive-0.1.1 lib/coactive/config.rb