Class: PgDice::ValidationFactory
- Inherits:
-
Object
- Object
- PgDice::ValidationFactory
- Defined in:
- lib/pgdice/validation_factory.rb
Overview
Factory for PgDice::Validations
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(configuration, opts = {}) ⇒ ValidationFactory
constructor
A new instance of ValidationFactory.
Constructor Details
#initialize(configuration, opts = {}) ⇒ ValidationFactory
Returns a new instance of ValidationFactory.
6 7 8 9 10 11 |
# File 'lib/pgdice/validation_factory.rb', line 6 def initialize(configuration, opts = {}) @configuration = configuration @partition_lister_factory = opts[:partition_lister_factory] ||= PgDice::PartitionListerFactory.new(@configuration) @period_fetcher_factory = opts[:period_fetcher_factory] ||= PgDice::PeriodFetcherFactory.new(@configuration) @current_date_provider = opts[:current_date_provider] ||= proc { Time.now.utc.to_date } end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/pgdice/validation_factory.rb', line 13 def call PgDice::Validation.new(logger: @configuration.logger, partition_lister: @partition_lister_factory.call, period_fetcher: @period_fetcher_factory.call, approved_tables: @configuration.approved_tables, current_date_provider: @current_date_provider) end |