Sha256: 2939731014979fd6aa371bc0f40904b8ecdf6e5de6f30d8591c7b2438dd2f54f

Contents?: true

Size: 434 Bytes

Versions: 6

Compression:

Stored size: 434 Bytes

Contents

# frozen_string_literal: true

module LicenseFinder
  class License
    module Text
      SPACES = /\s+/
      QUOTES = /['`"]{1,2}/
      PLACEHOLDERS = /<[^<>]+>/

      def self.normalize_punctuation(text)
        text.gsub(SPACES, ' ')
            .gsub(QUOTES, '"')
            .strip
      end

      def self.compile_to_regex(text)
        Regexp.new(Regexp.escape(text).gsub(PLACEHOLDERS, '(.*)'))
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
license_finder-5.6.2 lib/license_finder/license/text.rb
license_finder-5.6.1 lib/license_finder/license/text.rb
license_finder-5.6.0 lib/license_finder/license/text.rb
license_finder-5.5.2 lib/license_finder/license/text.rb
license_finder-5.5.1 lib/license_finder/license/text.rb
license_finder-5.5.0 lib/license_finder/license/text.rb