Class: CssClassDuplicates::Globber
- Inherits:
-
Object
- Object
- CssClassDuplicates::Globber
- Defined in:
- lib/css_class_duplicates/globber.rb
Overview
The class compares strings using wildcard symbols
Class Method Summary collapse
Class Method Details
.for(value) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/css_class_duplicates/globber.rb', line 6 def self.for(value) return value if value.is_a?(Regexp) escaped = Regexp.escape(value).gsub('\*', '.*?') Regexp.new("^#{escaped}$", Regexp::IGNORECASE) end |