Sha256: ac1e3f691d2692823a152e3962f4fcb0a540cf91ef30ab6d6a3cc04f999bd84a

Contents?: true

Size: 393 Bytes

Versions: 18

Compression:

Stored size: 393 Bytes

Contents

# frozen_string_literal: true

module LicenseFinder
  class License
    HeaderMatcher = Struct.new(:base_matcher, :first_n_lines) do
      def matches_text?(text)
        n = if first_n_lines.nil?
              1
            else
              first_n_lines
            end
        header = text.lines.first(n).join || ''
        base_matcher.matches_text?(header)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
license_finder-7.1.0 lib/license_finder/license/header_matcher.rb
license_finder-7.0.1 lib/license_finder/license/header_matcher.rb
license_finder-7.0.0 lib/license_finder/license/header_matcher.rb
license_finder-6.15.0 lib/license_finder/license/header_matcher.rb
gitlab-license_finder-6.14.2.1 lib/license_finder/license/header_matcher.rb
license_finder-6.14.2 lib/license_finder/license/header_matcher.rb
license_finder-6.14.1 lib/license_finder/license/header_matcher.rb
license_finder-6.13.0 lib/license_finder/license/header_matcher.rb
license_finder-6.12.2 lib/license_finder/license/header_matcher.rb
license_finder-6.12.1 lib/license_finder/license/header_matcher.rb
license_finder-6.12.0 lib/license_finder/license/header_matcher.rb
license_finder-6.11.0 lib/license_finder/license/header_matcher.rb
license_finder-6.10.1 lib/license_finder/license/header_matcher.rb
license_finder-6.10.0 lib/license_finder/license/header_matcher.rb
license_finder-6.9.0 lib/license_finder/license/header_matcher.rb
license_finder-6.8.2 lib/license_finder/license/header_matcher.rb
license_finder-6.8.1 lib/license_finder/license/header_matcher.rb
license_finder-6.8.0 lib/license_finder/license/header_matcher.rb