Class: LicenseFinder::DependencyReport
- Inherits:
-
Object
- Object
- LicenseFinder::DependencyReport
show all
- Defined in:
- lib/license_finder/reports/dependency_report.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(dependencies = []) ⇒ DependencyReport
Returns a new instance of DependencyReport.
17
18
19
|
# File 'lib/license_finder/reports/dependency_report.rb', line 17
def initialize(dependencies=[])
@dependencies = Array dependencies
end
|
Class Method Details
.of(dependencies) ⇒ Object
13
14
15
|
# File 'lib/license_finder/reports/dependency_report.rb', line 13
def self.of(dependencies)
new(dependencies).to_s
end
|
.underscored_name ⇒ Object
3
4
5
6
7
8
9
10
11
|
# File 'lib/license_finder/reports/dependency_report.rb', line 3
def self.underscored_name
@underscored_name ||= begin
str = name.dup
str.sub!(/.*::/, '')
str.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
str.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
str.downcase!
end
end
|
Instance Method Details
#to_s ⇒ Object
21
22
23
24
25
|
# File 'lib/license_finder/reports/dependency_report.rb', line 21
def to_s
filename = ROOT_PATH.join('templates', "#{self.class.underscored_name}.erb")
template = ERB.new(filename.read, nil, '-')
template.result(binding)
end
|