Class: Yard::Lint::Validators::Semantic::AbstractMethods::Parser
- Inherits:
-
Parsers::Base
- Object
- Parsers::Base
- Yard::Lint::Validators::Semantic::AbstractMethods::Parser
- Defined in:
- lib/yard/lint/validators/semantic/abstract_methods/parser.rb
Overview
Parser for @abstract method validation results
Instance Method Summary collapse
-
#call(yard_output) ⇒ Array<Hash>
Array with abstract method violation details.
Methods inherited from Parsers::Base
Instance Method Details
#call(yard_output) ⇒ Array<Hash>
Returns array with abstract method violation details.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yard/lint/validators/semantic/abstract_methods/parser.rb', line 12 def call(yard_output) return [] if yard_output.nil? || yard_output.empty? lines = yard_output.split("\n").reject(&:empty?) results = [] lines.each_slice(2) do |location_line, status_line| next unless location_line && status_line next unless status_line == 'has_implementation' # Parse location line: "file.rb:10: ClassName#method_name" match = location_line.match(/^(.+):(\d+): (.+)$/) next unless match file = match[1] line = match[2].to_i method_name = match[3] results << { name: 'AbstractMethod', method_name: method_name, location: file, line: line } end results end |