Sha256: f321a00760529cdd9381d12425391eda51e032484f3e9ed45b786e01ec5d76b3

Contents?: true

Size: 603 Bytes

Versions: 2

Compression:

Stored size: 603 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

    def file_path
      @file_path.relative_path_from(@install_path).to_s
    end

    def file_name
      @file_path.basename.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 lib/license_finder/possible_license_file.rb
license_finder-0.9.5-java lib/license_finder/possible_license_file.rb