Class: SvgConform::Commands::Check

Inherits:
Object
  • Object
show all
Defined in:
lib/svg_conform/commands/check.rb

Overview

Check command for validating SVG files (single or batch)

Defined Under Namespace

Classes: CheckError, DirectoryNotFoundError, FileNotFoundError, NoFilesFoundError

Instance Method Summary collapse

Constructor Details

#initialize(files, options) ⇒ Check

Returns a new instance of Check.



19
20
21
22
# File 'lib/svg_conform/commands/check.rb', line 19

def initialize(files, options)
  @files = Array(files)
  @options = options
end

Instance Method Details

#executeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/svg_conform/commands/check.rb', line 24

def execute
  # Determine which files to process
  files_to_process = determine_files

  if files_to_process.empty?
    raise NoFilesFoundError, "No SVG files found"
  end

  # Single file mode vs batch mode
  if files_to_process.length == 1 && !@options[:directory]
    process_single_file(files_to_process.first)
  else
    process_batch(files_to_process)
  end
end