Class: PgDice::PeriodFetcherFactory

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pgdice/period_fetcher_factory.rb

Overview

Factory for PeriodFetcher

Instance Method Summary collapse

Constructor Details

#initialize(configuration, opts = {}) ⇒ PeriodFetcherFactory

Returns a new instance of PeriodFetcherFactory.



10
11
12
13
# File 'lib/pgdice/period_fetcher_factory.rb', line 10

def initialize(configuration, opts = {})
  @configuration = configuration
  @query_executor = opts[:query_executor] ||= ->(sql) { database_connection.execute(sql).values.flatten.compact }
end

Instance Method Details

#callObject



15
16
17
# File 'lib/pgdice/period_fetcher_factory.rb', line 15

def call
  PgDice::PeriodFetcher.new(query_executor: @query_executor)
end