Class: PgDice::PartitionDropper
- Inherits:
-
Object
- Object
- PgDice::PartitionDropper
- Defined in:
- lib/pgdice/partition_dropper.rb
Overview
Simple class used to provide a mechanism that users can hook into if they want to override this default behavior for dropping a table.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#query_executor ⇒ Object
readonly
Returns the value of attribute query_executor.
Instance Method Summary collapse
- #call(old_partitions) ⇒ Object
-
#initialize(logger:, query_executor:) ⇒ PartitionDropper
constructor
A new instance of PartitionDropper.
Constructor Details
#initialize(logger:, query_executor:) ⇒ PartitionDropper
Returns a new instance of PartitionDropper.
10 11 12 13 |
# File 'lib/pgdice/partition_dropper.rb', line 10 def initialize(logger:, query_executor:) @logger = logger @query_executor = query_executor end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/pgdice/partition_dropper.rb', line 8 def logger @logger end |
#query_executor ⇒ Object (readonly)
Returns the value of attribute query_executor.
8 9 10 |
# File 'lib/pgdice/partition_dropper.rb', line 8 def query_executor @query_executor end |
Instance Method Details
#call(old_partitions) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/pgdice/partition_dropper.rb', line 15 def call(old_partitions) logger.info { "Partitions to be deleted are: #{old_partitions}" } query_executor.call(generate_drop_sql(old_partitions)) old_partitions end |