Sha256: 8625282d81b7faadde5a65c82a6b9ef9539e233425cf0b233c76ad95eb6e5e02

Contents?: true

Size: 403 Bytes

Versions: 14

Compression:

Stored size: 403 Bytes

Contents

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

14 entries across 14 versions & 1 rubygems

Version Path
license_finder-5.4.1 lib/license_finder/license/text.rb
license_finder-5.4.0 lib/license_finder/license/text.rb
license_finder-5.3.0 lib/license_finder/license/text.rb
license_finder-5.2.3 lib/license_finder/license/text.rb
license_finder-5.2.1 lib/license_finder/license/text.rb
license_finder-5.2.0 lib/license_finder/license/text.rb
license_finder-5.1.1 lib/license_finder/license/text.rb
license_finder-5.1.0 lib/license_finder/license/text.rb
license_finder-5.0.3 lib/license_finder/license/text.rb
license_finder-5.0.2 lib/license_finder/license/text.rb
license_finder-5.0.0 lib/license_finder/license/text.rb
license_finder-4.0.2 lib/license_finder/license/text.rb
license_finder-4.0.1 lib/license_finder/license/text.rb
license_finder-3.1.1 lib/license_finder/license/text.rb