Class: Yard::Lint::Validators::Documentation::UndocumentedBooleanMethods::Parser
- Inherits:
-
Parsers::Base
- Object
- Parsers::Base
- Yard::Lint::Validators::Documentation::UndocumentedBooleanMethods::Parser
- Defined in:
- lib/yard/lint/validators/documentation/undocumented_boolean_methods/parser.rb
Overview
Class used to extract details about undocumented boolean methods
Constant Summary collapse
- LOCATION_REGEX =
Regex to extract location and method name from yard list output
/^(.+)#(.+)$|^(.+)\.(.+)$/
Instance Method Summary collapse
-
#call(yard_list) ⇒ Array<Hash>
Array with undocumented boolean methods details.
Methods inherited from Parsers::Base
Instance Method Details
#call(yard_list) ⇒ Array<Hash>
Returns Array with undocumented boolean methods details.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/yard/lint/validators/documentation/undocumented_boolean_methods/parser.rb', line 18 def call(yard_list) yard_list .split("\n") .reject(&:empty?) .filter_map do |line| match_data = line.match(LOCATION_REGEX) next unless match_data # Handle both instance (#) and class (.) methods location = match_data[1] || match_data[3] method_name = match_data[2] || match_data[4] { location: location, element: "#{location}##{method_name}", method_name: method_name, line: 0 # YARD list doesn't provide line numbers } end end |