Class: Docspec::CLI
- Inherits:
-
Object
- Object
- Docspec::CLI
- Defined in:
- lib/docspec/cli.rb
Instance Attribute Summary collapse
-
#exit_code ⇒ Object
readonly
Returns the value of attribute exit_code.
-
#failed_examples ⇒ Object
readonly
Returns the value of attribute failed_examples.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#total_examples ⇒ Object
readonly
Returns the value of attribute total_examples.
Instance Method Summary collapse
-
#initialize(target = nil) ⇒ CLI
constructor
A new instance of CLI.
- #mode ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(target = nil) ⇒ CLI
Returns a new instance of CLI.
8 9 10 |
# File 'lib/docspec/cli.rb', line 8 def initialize(target=nil) @target = target || 'README.md' end |
Instance Attribute Details
#exit_code ⇒ Object (readonly)
Returns the value of attribute exit_code.
6 7 8 |
# File 'lib/docspec/cli.rb', line 6 def exit_code @exit_code end |
#failed_examples ⇒ Object (readonly)
Returns the value of attribute failed_examples.
6 7 8 |
# File 'lib/docspec/cli.rb', line 6 def failed_examples @failed_examples end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/docspec/cli.rb', line 6 def target @target end |
#total_examples ⇒ Object (readonly)
Returns the value of attribute total_examples.
6 7 8 |
# File 'lib/docspec/cli.rb', line 6 def total_examples @total_examples end |
Instance Method Details
#mode ⇒ Object
12 13 14 |
# File 'lib/docspec/cli.rb', line 12 def mode File.directory?(target) ? :dir : :file end |
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/docspec/cli.rb', line 16 def run abort "Target not found: #{target}" unless File.exist? target @exit_code = 0 @total_examples = 0 @failed_examples = 0 if mode == :dir run_dir else run_file target end end |