Class: RuboCop::RSpec::DescriptionExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/rspec/description_extractor.rb

Overview

Extracts cop descriptions from YARD docstrings

Defined Under Namespace

Classes: CodeObject

Instance Method Summary collapse

Constructor Details

#initialize(yardocs) ⇒ DescriptionExtractor

Returns a new instance of DescriptionExtractor.



7
8
9
# File 'lib/rubocop/rspec/description_extractor.rb', line 7

def initialize(yardocs)
  @code_objects = yardocs.map(&CodeObject.public_method(:new))
end

Instance Method Details

#to_hObject



11
12
13
14
15
16
# File 'lib/rubocop/rspec/description_extractor.rb', line 11

def to_h
  code_objects
    .select(&:rspec_cop?)
    .map(&:configuration)
    .reduce(:merge)
end