Class: ActiveRecordDataLoader::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_data_loader/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_batch_size: 100_000, default_row_count: 1, logger: nil, statement_timeout: "2min", connection_factory: -> { ::ActiveRecord::Base.connection }, raise_on_duplicates: false, max_duplicate_retries: 5, output: nil) ⇒ Configuration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_record_data_loader/configuration.rb', line 9

def initialize(
  default_batch_size: 100_000,
  default_row_count: 1,
  logger: nil,
  statement_timeout: "2min",
  connection_factory: -> { ::ActiveRecord::Base.connection },
  raise_on_duplicates: false,
  max_duplicate_retries: 5,
  output: nil
)
  @default_batch_size = default_batch_size
  @default_row_count = default_row_count
  @logger = logger || default_logger
  @statement_timeout = statement_timeout
  @connection_factory = connection_factory
  @raise_on_duplicates = raise_on_duplicates
  @max_duplicate_retries = max_duplicate_retries
  self.output = output
end

Instance Attribute Details

#connection_factoryObject

Returns the value of attribute connection_factory.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def connection_factory
  @connection_factory
end

#default_batch_sizeObject

Returns the value of attribute default_batch_size.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def default_batch_size
  @default_batch_size
end

#default_row_countObject

Returns the value of attribute default_row_count.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def default_row_count
  @default_row_count
end

#loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def logger
  @logger
end

#max_duplicate_retriesObject

Returns the value of attribute max_duplicate_retries.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def max_duplicate_retries
  @max_duplicate_retries
end

#outputObject

Returns the value of attribute output.



7
8
9
# File 'lib/active_record_data_loader/configuration.rb', line 7

def output
  @output
end

#raise_on_duplicatesObject

Returns the value of attribute raise_on_duplicates.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def raise_on_duplicates
  @raise_on_duplicates
end

#statement_timeoutObject

Returns the value of attribute statement_timeout.



5
6
7
# File 'lib/active_record_data_loader/configuration.rb', line 5

def statement_timeout
  @statement_timeout
end