Sha256: d0e5094ccb958883fdc4c4820a8c4ce25d5c6d8090de1f6fc1581a963f7604d4

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module MasterDataTool
  module Verify
    class Config
      DEFAULT_VALUES = {
        only_tables: [],
        except_tables: [],
        preload_belongs_to_associations: true,
        preload_associations: {},
        eager_load_associations: {}
      }

      attr_accessor :only_tables, :except_tables, :preload_belongs_to_associations,
                    :preload_associations,  # key: Class, value: associations
                    :eager_load_associations # key: Class, value: associations

      def initialize(only_tables:, except_tables:, preload_belongs_to_associations:, preload_associations:, eager_load_associations:)
        @only_tables = only_tables
        @except_tables = except_tables
        @preload_belongs_to_associations = preload_belongs_to_associations
        @preload_associations = preload_associations
        @eager_load_associations = eager_load_associations
      end

      def skip_table?(table_name)
        MasterDataTool.need_skip_table?(table_name, only_tables, except_tables)
      end

      def configure
        yield self
      end

      class << self
        def default_config
          new(**DEFAULT_VALUES)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
master_data_tool-0.23.0 lib/master_data_tool/verify/config.rb