Class: Licensee::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/licensee/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path) ⇒ Project

Returns a new instance of Project.



6
7
8
9
# File 'lib/licensee/project.rb', line 6

def initialize(base_path)
  raise "Invalid directory" unless File.directory?(base_path)
  @base_path = File.expand_path(base_path)
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



4
5
6
# File 'lib/licensee/project.rb', line 4

def base_path
  @base_path
end

Instance Method Details

#licenseObject



19
20
21
# File 'lib/licensee/project.rb', line 19

def license
  @license ||= license_file.match if license_file
end

#license_fileObject



11
12
13
# File 'lib/licensee/project.rb', line 11

def license_file
  @license_file ||= Licensee::LicenseFile.find(base_path)
end

#matchesObject



15
16
17
# File 'lib/licensee/project.rb', line 15

def matches
  @matches ||= license_file.matches if license_file
end