Class: RubocopChallenger::Rubocop::Yardoc
- Inherits:
-
Object
- Object
- RubocopChallenger::Rubocop::Yardoc
- Defined in:
- lib/rubocop_challenger/rubocop/yardoc.rb
Overview
To read YARD style documentation from rubocop gem source code
Instance Method Summary collapse
- #description ⇒ Object
- #examples ⇒ Object
-
#initialize(cop) ⇒ Yardoc
constructor
A new instance of Yardoc.
-
#safe_autocorrect? ⇒ Boolean
Indicates whether the autocorrect a cop does is safe (equivalent) by design.
Constructor Details
#initialize(cop) ⇒ Yardoc
Returns a new instance of Yardoc.
7 8 9 10 11 |
# File 'lib/rubocop_challenger/rubocop/yardoc.rb', line 7 def initialize(cop) load_rubocop_gems! @cop_class = find_cop_class(cop) load_yardoc! end |
Instance Method Details
#description ⇒ Object
13 14 15 |
# File 'lib/rubocop_challenger/rubocop/yardoc.rb', line 13 def description yardoc.docstring end |
#examples ⇒ Object
17 18 19 |
# File 'lib/rubocop_challenger/rubocop/yardoc.rb', line 17 def examples yardoc.('example').map { |tag| [tag.name, tag.text] } end |
#safe_autocorrect? ⇒ Boolean
Indicates whether the autocorrect a cop does is safe (equivalent) by design. If a cop is unsafe its autocorrect automatically becomes unsafe as well.
25 26 27 28 |
# File 'lib/rubocop_challenger/rubocop/yardoc.rb', line 25 def safe_autocorrect? config = RuboCop::ConfigLoader.default_configuration cop_class.new(config).safe_autocorrect? end |