Class: Yard::Lint::Validators::Documentation::UndocumentedMethodArguments::Parser
- Inherits:
-
Parsers::Base
- Object
- Parsers::Base
- Yard::Lint::Validators::Documentation::UndocumentedMethodArguments::Parser
- Defined in:
- lib/yard/lint/validators/documentation/undocumented_method_arguments/parser.rb
Overview
Class used to extract details about methods with undocumented arguments
Constant Summary collapse
- LOCATION_REGEX =
Regex to extract file, line, and object title from yard list output Format: /path/to/file.rb:10: ClassName#method_name
/^(.+):(\d+):\s+(.+)$/- TITLE_REGEX =
Splits an object title into namespace and method name on the last # or . separator. Top-level methods (#foo) have an empty namespace; titles without a separator (e.g. Foo::Bar, CONST) are kept whole.
/\A(.*)[#.]([^#.]+)\z/
Instance Method Summary collapse
-
#call(yard_list) ⇒ Array<Hash>
Array with undocumented method arguments details.
Methods inherited from Parsers::Base
Instance Method Details
#call(yard_list) ⇒ Array<Hash>
Returns Array with undocumented method arguments details.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/yard/lint/validators/documentation/undocumented_method_arguments/parser.rb', line 22 def call(yard_list) yard_list .split("\n") .reject(&:empty?) .filter_map do |line| match_data = line.match(LOCATION_REGEX) next unless match_data # Extract: file path, line number, class name, method name file_path = match_data[1] line_number = match_data[2].to_i class_name, method_name = split_title(match_data[3]) { location: file_path, method_name: method_name, line: line_number, class_name: class_name } end end |