Class: Docspec::CLI

Inherits:
Object
  • Object
show all
Includes:
Colsole
Defined in:
lib/docspec/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ CLI

Returns a new instance of CLI.



9
10
11
12
# File 'lib/docspec/cli.rb', line 9

def initialize(*targets)
  targets = ['README.md'] if targets.empty?
  @targets = targets
end

Instance Attribute Details

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



7
8
9
# File 'lib/docspec/cli.rb', line 7

def exit_code
  @exit_code
end

#failed_examplesObject (readonly)

Returns the value of attribute failed_examples.



7
8
9
# File 'lib/docspec/cli.rb', line 7

def failed_examples
  @failed_examples
end

#targetsObject (readonly)

Returns the value of attribute targets.



7
8
9
# File 'lib/docspec/cli.rb', line 7

def targets
  @targets
end

#total_examplesObject (readonly)

Returns the value of attribute total_examples.



7
8
9
# File 'lib/docspec/cli.rb', line 7

def total_examples
  @total_examples
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
# File 'lib/docspec/cli.rb', line 14

def run
  @exit_code = 0
  @total_examples = 0
  @failed_examples = 0

  targets.each { |target| run_target target }

  show_footer
end