Class: YARD::CLI::Doctest

Inherits:
Command
  • Object
show all
Defined in:
lib/yard/cli/doctest.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



5
6
7
# File 'lib/yard/cli/doctest.rb', line 5

def description
  'Doctests from @example tags'
end

#run(*args) ⇒ Object

Runs the command line, parsing arguments and generating tests.

Parameters:

  • args (Array<String>)

    Switches are passed to minitest, everything else is treated as the list of directories/files or glob



16
17
18
19
20
21
22
23
24
25
# File 'lib/yard/cli/doctest.rb', line 16

def run(*args)
  files = args.select { |arg| arg !~ /^-/ }

  files = parse_files(files)
  examples = parse_examples(files)

  add_pwd_to_path

  generate_tests(examples)
end