module CountVonCount

Constants

VERSION

Public Class Methods

default_code_paths() click to toggle source
# File lib/count_von_count.rb, line 20
def self.default_code_paths
  return [
    "app/**/*.rb",
    "lib/**/*.rb"
  ]
end
default_test_paths() click to toggle source
# File lib/count_von_count.rb, line 27
def self.default_test_paths
  return [
    "spec/**/*_spec.rb"
  ]
end
formatters() click to toggle source
# File lib/count_von_count.rb, line 33
def self.formatters
  {
    txt: CountVonCount::Formatters::Text,
    json: CountVonCount::Formatters::Json,
    yaml: CountVonCount::Formatters::Yaml
  }
end
new(path, code_paths=nil, test_paths=nil, no_default=false, format=:txt, output = nil) click to toggle source
# File lib/count_von_count.rb, line 6
def self.new(path, code_paths=nil, test_paths=nil, no_default=false, format=:txt, output = nil)
  code_paths = code_paths || []
  test_paths = test_paths || []
  path = Pathname.new(path).realpath
  unless no_default
    code_paths = default_code_paths + code_paths
    test_paths = default_test_paths + test_paths
  end
  raise "No code paths given" if code_paths.empty?

  formatter = formatters[format].new(path, output)
  CountVonCount::Counter.new(path, code_paths, test_paths, formatter)
end