Class: SvgConform::Compatibility::AnalysisContext
- Inherits:
-
Object
- Object
- SvgConform::Compatibility::AnalysisContext
- Defined in:
- lib/svg_conform/compatibility/analysis_context.rb
Overview
Value object representing the context and configuration for compatibility analysis
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#semantic ⇒ Object
readonly
Returns the value of attribute semantic.
-
#svgcheck_dir ⇒ Object
readonly
Returns the value of attribute svgcheck_dir.
Instance Method Summary collapse
- #batch_analysis? ⇒ Boolean
- #check_mode? ⇒ Boolean
- #file_output? ⇒ Boolean
-
#initialize(options = {}) ⇒ AnalysisContext
constructor
A new instance of AnalysisContext.
- #input_file_path ⇒ Object
- #inputs_dir ⇒ Object
- #outputs_dir ⇒ Object
- #repair_mode? ⇒ Boolean
- #semantic_analysis? ⇒ Boolean
- #single_file_analysis? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ AnalysisContext
Returns a new instance of AnalysisContext.
9 10 11 12 13 14 15 16 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 9 def initialize( = {}) @mode = ([:mode] || "check").to_sym @profile = [:profile]&.to_sym || :svg_1_2_rfc_compatible @semantic = [:semantic] || false @svgcheck_dir = [:svgcheck_dir] || "spec/fixtures/svgcheck" @file = [:file] @output_file = [:output] end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 7 def file @file end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
7 8 9 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 7 def mode @mode end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
7 8 9 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 7 def output_file @output_file end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
7 8 9 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 7 def profile @profile end |
#semantic ⇒ Object (readonly)
Returns the value of attribute semantic.
7 8 9 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 7 def semantic @semantic end |
#svgcheck_dir ⇒ Object (readonly)
Returns the value of attribute svgcheck_dir.
7 8 9 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 7 def svgcheck_dir @svgcheck_dir end |
Instance Method Details
#batch_analysis? ⇒ Boolean
22 23 24 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 22 def batch_analysis? @file.nil? end |
#check_mode? ⇒ Boolean
26 27 28 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 26 def check_mode? @mode == :check end |
#file_output? ⇒ Boolean
38 39 40 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 38 def file_output? !@output_file.nil? end |
#input_file_path ⇒ Object
50 51 52 53 54 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 50 def input_file_path return nil unless single_file_analysis? File.join(inputs_dir, @file) end |
#inputs_dir ⇒ Object
42 43 44 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 42 def inputs_dir File.join(@svgcheck_dir, "inputs") end |
#outputs_dir ⇒ Object
46 47 48 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 46 def outputs_dir File.join(@svgcheck_dir, @mode.to_s) end |
#repair_mode? ⇒ Boolean
30 31 32 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 30 def repair_mode? @mode == :repair end |
#semantic_analysis? ⇒ Boolean
34 35 36 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 34 def semantic_analysis? @semantic end |
#single_file_analysis? ⇒ Boolean
18 19 20 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 18 def single_file_analysis? !@file.nil? end |
#to_h ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/svg_conform/compatibility/analysis_context.rb', line 56 def to_h { mode: @mode, profile: @profile, semantic: @semantic, svgcheck_dir: @svgcheck_dir, file: @file, output_file: @output_file, } end |