Sha256: e3257770be92a716507242be33fd2b5a104d0df2bc79846db827a85d33cba65b

Contents?: true

Size: 665 Bytes

Versions: 2

Compression:

Stored size: 665 Bytes

Contents

module LicenseFinder
  class PossibleLicenseFile
    def initialize(install_path, file_path)
      @install_path = Pathname.new(install_path)
      @file_path = Pathname.new(file_path)
    end

    # Unused, except in tests, but might be useful if LF ever reports the
    # locations of all the files it searched.
    def file_path
      @file_path.relative_path_from(@install_path).to_s
    end

    def text
      @text ||= @file_path.send(@file_path.respond_to?(:binread) ? :binread : :read)
    end

    def license
      license = License.all.detect do |klass|
        klass.new(text).matches?
      end

      license.pretty_name if license
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-0.9.5.1-java lib/license_finder/possible_license_file.rb
license_finder-0.9.5.1 lib/license_finder/possible_license_file.rb