Class: Uniword::Batch::QualityCheckStage
- Inherits:
-
ProcessingStage
- Object
- ProcessingStage
- Uniword::Batch::QualityCheckStage
- Defined in:
- lib/uniword/batch/stages/quality_check_stage.rb
Overview
Processing stage that runs quality checks on documents.
Responsibility: Run document quality checker with configured rules. Single Responsibility - only handles quality checking.
Instance Attribute Summary
Attributes inherited from ProcessingStage
Instance Method Summary collapse
-
#description ⇒ String
Get stage description.
-
#initialize(options = {}) ⇒ QualityCheckStage
constructor
Initialize quality check stage.
-
#process(document, context = {}) ⇒ Document
Process document to run quality checks.
Methods inherited from ProcessingStage
Constructor Details
#initialize(options = {}) ⇒ QualityCheckStage
Initialize quality check stage
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/uniword/batch/stages/quality_check_stage.rb', line 24 def initialize( = {}) super @rules_file = [:rules_file] @fail_on_errors = .fetch(:fail_on_errors, false) @fail_on_warnings = .fetch(:fail_on_warnings, false) @generate_report = .fetch(:generate_report, true) # Initialize quality checker @checker = initialize_checker end |
Instance Method Details
#description ⇒ String
Get stage description
65 66 67 |
# File 'lib/uniword/batch/stages/quality_check_stage.rb', line 65 def description "Run quality checks" end |
#process(document, context = {}) ⇒ Document
Process document to run quality checks
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/uniword/batch/stages/quality_check_stage.rb', line 41 def process(document, context = {}) log "Running quality checks on #{context[:filename]}" # Run quality checker report = @checker.check(document) # Log results log_report_summary(report) # Generate report file if requested if @generate_report && context[:output_path] generate_report_file(report, context) end # Check if we should fail check_failure_conditions(report, context[:filename]) document end |