class Courgette::Commands::Stats

Public Class Methods

new(options) click to toggle source
# File lib/courgette/commands/stats.rb, line 6
def initialize options
  @options = options
end

Public Instance Methods

print_reference(fo, fi, ref) click to toggle source
run() click to toggle source
# File lib/courgette/commands/stats.rb, line 10
def run
  stats.each do |fanout, fanin, reference|
    print_reference fanout, fanin, reference
  end
end

Private Instance Methods

glob() click to toggle source
# File lib/courgette/commands/stats.rb, line 21
def glob
  @options.glob
end
graph() click to toggle source
# File lib/courgette/commands/stats.rb, line 35
def graph
  @graph ||= Courgette::DirectoryAnalyser.new.tap do |da|
    da.analyse glob
  end.graph
end
stats() click to toggle source
# File lib/courgette/commands/stats.rb, line 25
def stats
  @stats ||= graph.nodes.map do |node|
    [
      graph.dependency_count(node),
      graph.depender_count(node),
      node
    ]
  end.sort
end