Class: LicenseFinder::PossibleLicenseFile
- Inherits:
-
Object
- Object
- LicenseFinder::PossibleLicenseFile
- Defined in:
- lib/license_finder/package_utils/possible_license_file.rb
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ PossibleLicenseFile
constructor
A new instance of PossibleLicenseFile.
- #license ⇒ Object
- #path ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ PossibleLicenseFile
Returns a new instance of PossibleLicenseFile.
5 6 7 8 |
# File 'lib/license_finder/package_utils/possible_license_file.rb', line 5 def initialize(path, = {}) @path = Pathname(path) @logger = [:logger] end |
Instance Method Details
#license ⇒ Object
14 15 16 |
# File 'lib/license_finder/package_utils/possible_license_file.rb', line 14 def license License.find_by_text(text) end |
#path ⇒ Object
10 11 12 |
# File 'lib/license_finder/package_utils/possible_license_file.rb', line 10 def path @path.to_s end |
#text ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/license_finder/package_utils/possible_license_file.rb', line 18 def text if @path.exist? @text ||= (@path.respond_to?(:binread) ? @path.binread : @path.read) else @logger.info('ERROR', "#{@path} does not exists", color: :red) '' end end |