Class: Equilibrium::Commands::AnalyzeCommand

Inherits:
Object
  • Object
show all
Includes:
Mixins::ErrorHandling, Mixins::InputOutput
Defined in:
lib/equilibrium/commands/analyze_command.rb

Overview

Command for analyzing expected vs actual tags with unified structure

Instance Method Summary collapse

Methods included from Mixins::InputOutput

#format_output, #read_input_data

Methods included from Mixins::ErrorHandling

#with_error_handling

Instance Method Details

#execute(options = {}) ⇒ Object

Execute the analyze command

Parameters:

  • options (Hash) (defaults to: {})

    Command options (expected, actual, format, etc.)



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/equilibrium/commands/analyze_command.rb', line 21

def execute(options = {})
  with_error_handling do
    # Load and validate data files
    expected_data = load_and_validate_json_file(options[:expected], error_prefix: "Expected data schema validation failed")
    actual_data = load_and_validate_json_file(options[:actual], error_prefix: "Actual data schema validation failed")

    # Perform analysis
    analysis = Analyzer.analyze(expected_data, actual_data)

    # Validate output schema
    SchemaValidator.validate!(analysis, Equilibrium::Schemas::ANALYZER_OUTPUT, error_prefix: "Analyzer output schema validation failed")

    # Format and display output
    format_output(analysis, options[:format] || "summary", "analysis")
  end
end