Class: SvgConform::Compatibility::PatternDiscoveryEngine
- Inherits:
-
Object
- Object
- SvgConform::Compatibility::PatternDiscoveryEngine
- Defined in:
- lib/svg_conform/compatibility/pattern_discovery.rb
Overview
Enhanced pattern discovery engine
Instance Attribute Summary collapse
-
#discovered_patterns ⇒ Object
readonly
Returns the value of attribute discovered_patterns.
-
#unmapped_patterns ⇒ Object
readonly
Returns the value of attribute unmapped_patterns.
Instance Method Summary collapse
- #analyze_file_patterns(filename) ⇒ Object
- #discover_patterns_from_files(target_files) ⇒ Object
-
#initialize ⇒ PatternDiscoveryEngine
constructor
A new instance of PatternDiscoveryEngine.
Constructor Details
#initialize ⇒ PatternDiscoveryEngine
Returns a new instance of PatternDiscoveryEngine.
49 50 51 52 53 |
# File 'lib/svg_conform/compatibility/pattern_discovery.rb', line 49 def initialize @discovered_patterns = {} @unmapped_patterns = [] @semantic_comparator = SvgConform::SemanticComparator.new end |
Instance Attribute Details
#discovered_patterns ⇒ Object (readonly)
Returns the value of attribute discovered_patterns.
47 48 49 |
# File 'lib/svg_conform/compatibility/pattern_discovery.rb', line 47 def discovered_patterns @discovered_patterns end |
#unmapped_patterns ⇒ Object (readonly)
Returns the value of attribute unmapped_patterns.
47 48 49 |
# File 'lib/svg_conform/compatibility/pattern_discovery.rb', line 47 def unmapped_patterns @unmapped_patterns end |
Instance Method Details
#analyze_file_patterns(filename) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/svg_conform/compatibility/pattern_discovery.rb', line 69 def analyze_file_patterns(filename) puts " 📄 Analyzing patterns in: #{filename}" # Analyze SvgConform patterns svg_conform_patterns = extract_svg_conform_patterns(filename) svg_conform_patterns.each do |pattern| record_pattern("svg_conform", pattern, filename) end # Analyze svgcheck patterns svgcheck_patterns = extract_svgcheck_patterns(filename) svgcheck_patterns.each do |pattern| record_pattern("svgcheck", pattern, filename) end end |
#discover_patterns_from_files(target_files) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/svg_conform/compatibility/pattern_discovery.rb', line 55 def discover_patterns_from_files(target_files) puts "🔍 Discovering validation patterns from #{target_files.length} files..." target_files.each do |filename| analyze_file_patterns(filename) end categorize_patterns suggest_semantic_mappings identify_unmapped_patterns generate_discovery_report end |