Class: LicenseFinder::LicenseFiles
- Inherits:
-
Object
- Object
- LicenseFinder::LicenseFiles
- Defined in:
- lib/license_finder/package_utils/license_files.rb
Constant Summary collapse
- CANDIDATE_FILE_NAMES =
%w[LICENSE License license LICENCE Licence licence COPYING copying README readme].freeze
- CANDIDATE_PATH_WILDCARD =
"*{#{CANDIDATE_FILE_NAMES.join(',')}}*"
Class Method Summary collapse
Instance Method Summary collapse
- #find(options = {}) ⇒ Object
-
#initialize(install_path) ⇒ LicenseFiles
constructor
A new instance of LicenseFiles.
Constructor Details
#initialize(install_path) ⇒ LicenseFiles
Returns a new instance of LicenseFiles.
14 15 16 |
# File 'lib/license_finder/package_utils/license_files.rb', line 14 def initialize(install_path) @install_path = install_path ? Pathname(install_path) : nil end |
Class Method Details
.find(install_path, options = {}) ⇒ Object
10 11 12 |
# File 'lib/license_finder/package_utils/license_files.rb', line 10 def self.find(install_path, = {}) new(install_path).find() end |
Instance Method Details
#find(options = {}) ⇒ Object
18 19 20 21 22 |
# File 'lib/license_finder/package_utils/license_files.rb', line 18 def find( = {}) paths_of_candidate_files .map { |path| PossibleLicenseFile.new(path, ) } .reject { |file| file.license.nil? } end |