lib/nicht/stats.rb in nicht-0.1.0 vs lib/nicht/stats.rb in nicht-0.1.1
- old
+ new
@@ -4,10 +4,19 @@
@path = path + '/Gemfile'
@search = search
@stats = { per_project: {}, per_gem: {} }
end
+ def render
+ Dir[@path].each do |path|
+ scan_project path
+ end
+ output
+ end
+
+ private
+
def scan_record(line, project_name)
candidate = line.split(',').shift.split ' '
gem_name = candidate.last
return unless candidate.first == 'gem' || %w[* #].include?(gem_name[0])
add_stat(gem_name, project_name)
@@ -28,16 +37,9 @@
@stats[:per_project][project_name] = []
f.each_line do |line|
scan_record(line, project_name)
end
end
- end
-
- def render
- Dir[@path].each do |path|
- scan_project path
- end
- output
end
def output
if @search.nil?
ap @stats[:per_project]
\ No newline at end of file