Sha256: c2c2130dc308cdfd04fd450921165bcd9bded339f499e598af2d69bfbb368742

Contents?: true

Size: 455 Bytes

Versions: 16

Compression:

Stored size: 455 Bytes

Contents

# frozen_string_literal: true

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

      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

16 entries across 16 versions & 1 rubygems

Version Path
license_finder-6.3.0 lib/license_finder/license/text.rb
license_finder-6.2.0 lib/license_finder/license/text.rb
license_finder-6.1.2 lib/license_finder/license/text.rb
license_finder-6.1.0 lib/license_finder/license/text.rb
license_finder-6.0.0 lib/license_finder/license/text.rb
license_finder-5.11.1 lib/license_finder/license/text.rb
license_finder-5.11.0 lib/license_finder/license/text.rb
license_finder-5.10.2 lib/license_finder/license/text.rb
license_finder-5.10.1 lib/license_finder/license/text.rb
license_finder-5.10.0 lib/license_finder/license/text.rb
license_finder-5.9.2 lib/license_finder/license/text.rb
license_finder-5.9.1 lib/license_finder/license/text.rb
license_finder-5.9.0 lib/license_finder/license/text.rb
license_finder-5.8.0 lib/license_finder/license/text.rb
license_finder-5.7.1 lib/license_finder/license/text.rb
license_finder-5.7.0 lib/license_finder/license/text.rb