Class: CssClassDuplicates::Scanner
- Inherits:
-
Object
- Object
- CssClassDuplicates::Scanner
- Defined in:
- lib/css_class_duplicates/scanner.rb
Overview
This class scans string and returns all found matches with positions
Constant Summary collapse
- NEW_LINE =
/(\r\n|\r|\n)/.freeze
Instance Method Summary collapse
-
#initialize(content) ⇒ Scanner
constructor
A new instance of Scanner.
- #matches(regex) ⇒ Object
Constructor Details
#initialize(content) ⇒ Scanner
Returns a new instance of Scanner.
10 11 12 |
# File 'lib/css_class_duplicates/scanner.rb', line 10 def initialize(content) @content = content end |
Instance Method Details
#matches(regex) ⇒ Object
14 15 16 17 18 |
# File 'lib/css_class_duplicates/scanner.rb', line 14 def matches(regex) matches_with_positions(regex).map do |match, start_position| [match, file_line(start_position)] end end |