Class: DuckTesting::YARD::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/duck_testing/yard/parser.rb

Class Method Summary collapse

Class Method Details

.parse(paths, excluded) ⇒ Array<DuckTesting::YARD::ClassObject>

Parses a path or set of paths.

Parameters:

  • paths (String, Array<String>)

    a path, glob or list of paths to parse

  • excluded (Array<String, Regexp>)

    a list of excluded path matchers

Returns:



12
13
14
15
16
# File 'lib/duck_testing/yard/parser.rb', line 12

def parse(paths, excluded)
  ::YARD::Registry.clear
  ::YARD::Parser::SourceParser.parse(paths, excluded)
  ::YARD::Registry.all(:class).map { |class_object| ClassObject.new(class_object) }
end

.parse_string(content) ⇒ Array<DuckTesting::YARD::ClassObject>

Parses a string content.

Parameters:

  • content (String)

    the block of code to parse.

Returns:



22
23
24
25
26
# File 'lib/duck_testing/yard/parser.rb', line 22

def parse_string(content)
  ::YARD::Registry.clear
  ::YARD::Parser::SourceParser.parse_string(content)
  ::YARD::Registry.all(:class).map { |class_object| ClassObject.new(class_object) }
end