Class: RuboCop::RSpecRails::DescriptionExtractor::CodeObject

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

Overview

Decorator of a YARD code object for working with documented rspec cops

Constant Summary collapse

RSPEC_RAILS_COP_CLASS_NAME =
'RuboCop::Cop::RSpec::Base'
RUBOCOP_COP_CLASS_NAME =
'RuboCop::Cop::Base'

Instance Method Summary collapse

Constructor Details

#initialize(yardoc) ⇒ CodeObject

Returns a new instance of CodeObject.



27
28
29
# File 'lib/rubocop/rspec_rails/description_extractor.rb', line 27

def initialize(yardoc)
  @yardoc = yardoc
end

Instance Method Details

#configurationHash

Configuration for the documented cop that would live in default.yml

Returns:

  • (Hash)


41
42
43
# File 'lib/rubocop/rspec_rails/description_extractor.rb', line 41

def configuration
  { cop_name => { 'Description' => description } }
end

#rspec_rails_cop?Boolean

Test if the YARD code object documents a concrete cop class

Returns:

  • (Boolean)


34
35
36
# File 'lib/rubocop/rspec_rails/description_extractor.rb', line 34

def rspec_rails_cop?
  cop_subclass? && !abstract?
end