Class: SvgConform::ExternalCheckers::Svgcheck::Parser
- Inherits:
-
Object
- Object
- SvgConform::ExternalCheckers::Svgcheck::Parser
- Defined in:
- lib/svg_conform/external_checkers/svgcheck/parser.rb
Overview
Enhanced svgcheck output parser that uses mapping configuration
Instance Attribute Summary collapse
-
#mapping_config ⇒ Object
readonly
Returns the value of attribute mapping_config.
Instance Method Summary collapse
-
#initialize(mapping_config_path = nil) ⇒ Parser
constructor
A new instance of Parser.
-
#parse(output_content, _error_content = nil, filename: nil) ⇒ Object
Parse svgcheck output into a ConformanceReport.
Constructor Details
#initialize(mapping_config_path = nil) ⇒ Parser
Returns a new instance of Parser.
12 13 14 15 |
# File 'lib/svg_conform/external_checkers/svgcheck/parser.rb', line 12 def initialize(mapping_config_path = nil) @mapping_config_path = mapping_config_path || "config/svgcheck_mapping.yml" load_mapping_config end |
Instance Attribute Details
#mapping_config ⇒ Object (readonly)
Returns the value of attribute mapping_config.
10 11 12 |
# File 'lib/svg_conform/external_checkers/svgcheck/parser.rb', line 10 def mapping_config @mapping_config end |
Instance Method Details
#parse(output_content, _error_content = nil, filename: nil) ⇒ Object
Parse svgcheck output into a ConformanceReport
18 19 20 21 22 23 |
# File 'lib/svg_conform/external_checkers/svgcheck/parser.rb', line 18 def parse(output_content, _error_content = nil, filename: nil) return create_empty_report(filename) if output_content.nil? || output_content.strip.empty? errors = parse_error_lines(output_content) create_report_from_errors(errors, filename) end |