Class: Suma::SvgQuality::Scanner
- Inherits:
-
Object
- Object
- Suma::SvgQuality::Scanner
- Defined in:
- lib/suma/svg_quality/scanner.rb
Overview
Deep module behind the SVG-quality seam: takes paths in, returns
Report / BatchReport out. Owns validator construction and
per-file result capture. Does not own file discovery, sorting,
filtering, or presentation — those stay in the CLI adapter.
The progress adapter is injected: pass any object responding to
#call(index, total, report). NullProgress is the default
no-op; the CLI passes a lambda that writes to $stderr.
Defined Under Namespace
Classes: NullProgress
Constant Summary collapse
- DEFAULT_PROFILE =
:metanorma
Instance Attribute Summary collapse
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#progress ⇒ Object
readonly
Returns the value of attribute progress.
Instance Method Summary collapse
-
#initialize(profile: DEFAULT_PROFILE, progress: NullProgress.new) ⇒ Scanner
constructor
A new instance of Scanner.
- #scan(paths) ⇒ Object
- #scan_file(path) ⇒ Object
Constructor Details
#initialize(profile: DEFAULT_PROFILE, progress: NullProgress.new) ⇒ Scanner
Returns a new instance of Scanner.
20 21 22 23 24 |
# File 'lib/suma/svg_quality/scanner.rb', line 20 def initialize(profile: DEFAULT_PROFILE, progress: NullProgress.new) @profile = profile @progress = progress end |
Instance Attribute Details
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
18 19 20 |
# File 'lib/suma/svg_quality/scanner.rb', line 18 def profile @profile end |
#progress ⇒ Object (readonly)
Returns the value of attribute progress.
18 19 20 |
# File 'lib/suma/svg_quality/scanner.rb', line 18 def progress @progress end |
Instance Method Details
#scan(paths) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/suma/svg_quality/scanner.rb', line 26 def scan(paths) validator = build_validator reports = paths.each_with_index.map do |path, index| scan_one(validator, path, index, paths.size) end BatchReport.new(reports) end |