Class: PgDice::PeriodFetcherFactory
- Inherits:
-
Object
- Object
- PgDice::PeriodFetcherFactory
- Extended by:
- Forwardable
- Defined in:
- lib/pgdice/period_fetcher_factory.rb
Overview
Factory for PeriodFetcher
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(configuration, opts = {}) ⇒ PeriodFetcherFactory
constructor
A new instance of PeriodFetcherFactory.
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
#call ⇒ Object
15 16 17 |
# File 'lib/pgdice/period_fetcher_factory.rb', line 15 def call PgDice::PeriodFetcher.new(query_executor: @query_executor) end |