Class: SvgConform::QualityMetrics::FeatureDetector
- Inherits:
-
Object
- Object
- SvgConform::QualityMetrics::FeatureDetector
- Defined in:
- lib/svg_conform/quality_metrics/feature_detector.rb
Overview
Detects SVG features in file content using regex patterns.
Instance Method Summary collapse
-
#detect(content_or_path) ⇒ FeatureFlags
Detect features in content or file.
-
#initialize(config) ⇒ FeatureDetector
constructor
A new instance of FeatureDetector.
Constructor Details
#initialize(config) ⇒ FeatureDetector
Returns a new instance of FeatureDetector.
17 18 19 |
# File 'lib/svg_conform/quality_metrics/feature_detector.rb', line 17 def initialize(config) @config = config end |
Instance Method Details
#detect(content_or_path) ⇒ FeatureFlags
Detect features in content or file
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/svg_conform/quality_metrics/feature_detector.rb', line 25 def detect(content_or_path) content = read_content(content_or_path) FeatureFlags.new( has_base64: match_pattern?(:base64, content), has_foreign_ns: match_pattern?(:foreign_ns, content), has_masks: match_pattern?(:masks, content), has_clip_paths: match_pattern?(:clip_paths, content), has_external_refs: match_pattern?(:external_refs, content), ) end |