Class: LicenseFinder::PossibleLicenseFile

Inherits:
Object
  • Object
show all
Defined in:
lib/license_finder/packages/possible_license_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PossibleLicenseFile

Returns a new instance of PossibleLicenseFile.



3
4
5
# File 'lib/license_finder/packages/possible_license_file.rb', line 3

def initialize(path)
  @path = Pathname(path)
end

Instance Method Details

#licenseObject



11
12
13
# File 'lib/license_finder/packages/possible_license_file.rb', line 11

def license
  License.find_by_text(text)
end

#pathObject



7
8
9
# File 'lib/license_finder/packages/possible_license_file.rb', line 7

def path
  @path.to_s
end

#textObject



15
16
17
# File 'lib/license_finder/packages/possible_license_file.rb', line 15

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