Class: LicenseFinder::PossibleLicenseFile
- Inherits:
-
Object
- Object
- LicenseFinder::PossibleLicenseFile
- Defined in:
- lib/license_finder/possible_license_file.rb
Instance Method Summary collapse
-
#file_path ⇒ Object
Unused, except in tests, but might be useful if LF ever reports the locations of all the files it searched.
-
#initialize(install_path, file_path) ⇒ PossibleLicenseFile
constructor
A new instance of PossibleLicenseFile.
- #license ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(install_path, file_path) ⇒ PossibleLicenseFile
Returns a new instance of PossibleLicenseFile.
3 4 5 6 |
# File 'lib/license_finder/possible_license_file.rb', line 3 def initialize(install_path, file_path) @install_path = Pathname.new(install_path) @file_path = Pathname.new(file_path) end |
Instance Method Details
#file_path ⇒ Object
Unused, except in tests, but might be useful if LF ever reports the locations of all the files it searched.
10 11 12 |
# File 'lib/license_finder/possible_license_file.rb', line 10 def file_path @file_path.relative_path_from(@install_path).to_s end |
#license ⇒ Object
18 19 20 |
# File 'lib/license_finder/possible_license_file.rb', line 18 def license License.find_by_text(text) end |
#text ⇒ Object
14 15 16 |
# File 'lib/license_finder/possible_license_file.rb', line 14 def text @text ||= @file_path.send(@file_path.respond_to?(:binread) ? :binread : :read) end |