Module: CountVonCount

Defined in:
lib/count_von_count.rb,
lib/count_von_count/cli.rb,
lib/count_von_count/stat.rb,
lib/count_von_count/counter.rb,
lib/count_von_count/version.rb,
lib/count_von_count/formatter.rb

Defined Under Namespace

Modules: Formatters Classes: CLI, Counter, Stat

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Class Method Details

.default_code_pathsObject



20
21
22
23
24
25
# File 'lib/count_von_count.rb', line 20

def self.default_code_paths
  return [
    "app/**/*.rb",
    "lib/**/*.rb"
  ]
end

.default_test_pathsObject



27
28
29
30
31
# File 'lib/count_von_count.rb', line 27

def self.default_test_paths
  return [
    "spec/**/*_spec.rb"
  ]
end

.formattersObject



33
34
35
36
37
38
39
# 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) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# 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