Class: RuboCop::Cop::Force
- Inherits:
-
Object
- Object
- RuboCop::Cop::Force
- Defined in:
- lib/rubocop/cop/force.rb
Overview
A scaffold for concrete forces.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cops ⇒ Object
readonly
Returns the value of attribute cops.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cops) ⇒ Force
constructor
A new instance of Force.
- #investigate(_processed_source) ⇒ Object
- #name ⇒ Object
- #run_hook(method_name, *args) ⇒ Object
Constructor Details
#initialize(cops) ⇒ Force
Returns a new instance of Force.
21 22 23 |
# File 'lib/rubocop/cop/force.rb', line 21 def initialize(cops) @cops = cops end |
Instance Attribute Details
#cops ⇒ Object (readonly)
Returns the value of attribute cops.
7 8 9 |
# File 'lib/rubocop/cop/force.rb', line 7 def cops @cops end |
Class Method Details
.all ⇒ Object
9 10 11 |
# File 'lib/rubocop/cop/force.rb', line 9 def self.all @all ||= [] end |
.force_name ⇒ Object
17 18 19 |
# File 'lib/rubocop/cop/force.rb', line 17 def self.force_name name.split('::').last end |
.inherited(subclass) ⇒ Object
13 14 15 |
# File 'lib/rubocop/cop/force.rb', line 13 def self.inherited(subclass) all << subclass end |
Instance Method Details
#investigate(_processed_source) ⇒ Object
37 38 39 |
# File 'lib/rubocop/cop/force.rb', line 37 def investigate(_processed_source) # Do custom processing and invoke #run_hook at arbitrary timing. end |
#name ⇒ Object
25 26 27 |
# File 'lib/rubocop/cop/force.rb', line 25 def name self.class.force_name end |
#run_hook(method_name, *args) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/rubocop/cop/force.rb', line 29 def run_hook(method_name, *args) cops.each do |cop| next unless cop.respond_to?(method_name) cop.send(method_name, *args) end end |