Class: RuboCop::Cop::Force
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | lib/rubocop/cop/force.rb |
Overview
A scaffold for concrete forces.
Class Method Summary
- .all
- .force_name
- .inherited(subclass)
- .new(cops) ⇒ Force constructor
Instance Attribute Summary
- #cops readonly
Instance Method Summary
Constructor Details
.new(cops) ⇒ Force
Class Method Details
.all
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 9
def self.all @all ||= [] end
.force_name
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 18
def self.force_name name.split('::').last end
.inherited(subclass)
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 13
def self.inherited(subclass) super all << subclass end
Instance Attribute Details
#cops (readonly)
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 7
attr_reader :cops
Instance Method Details
#investigate(_processed_source)
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 38
def investigate(_processed_source) # Do custom processing and invoke #run_hook at arbitrary timing. end
#name
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 26
def name self.class.force_name end
#run_hook(method_name, *args)
[ GitHub ]# File 'lib/rubocop/cop/force.rb', line 30
def run_hook(method_name, *args) cops.each do |cop| next unless cop.respond_to?(method_name) cop.public_send(method_name, *args) end end