Module: LicenseFinder::License::Text
- Defined in:
- lib/license_finder/license/text.rb
Constant Summary collapse
- SPACES =
/\s+/.freeze
- QUOTES =
/['`"]{1,2}/.freeze
- PLACEHOLDERS =
/<[^<>]+>/.freeze
Class Method Summary collapse
Class Method Details
.compile_to_regex(text) ⇒ Object
16 17 18 |
# File 'lib/license_finder/license/text.rb', line 16 def self.compile_to_regex(text) Regexp.new(Regexp.escape(text).gsub(PLACEHOLDERS, '(.*)')) end |
.normalize_punctuation(text) ⇒ Object
10 11 12 13 14 |
# File 'lib/license_finder/license/text.rb', line 10 def self.normalize_punctuation(text) text.gsub(SPACES, ' ') .gsub(QUOTES, '"') .strip end |