Class: Gergich::Capture::BaseCapture
- Inherits:
-
Object
- Object
- Gergich::Capture::BaseCapture
show all
- Defined in:
- lib/gergich/capture.rb
Direct Known Subclasses
AndroidlintCapture, BrakemanCapture, EslintCapture, Flake8Capture, I18nlinerCapture, RubocopCapture, ShellcheckCapture, StylelintCapture, SwiftlintCapture, TscCapture, YamllintCapture
Class Method Summary
collapse
Class Method Details
.inherited(subclass) ⇒ Object
9
10
11
12
13
|
# File 'lib/gergich/capture.rb', line 9
def self.inherited(subclass)
super
name = normalize_captor_class_name(subclass)
Capture.captors[name] = subclass
end
|
.normalize_captor_class_name(subclass) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/gergich/capture.rb', line 15
def self.normalize_captor_class_name(subclass)
name = subclass.name.dup
name.gsub!(/.*::|Capture\z/, "")
name.gsub!(/([A-Z\d]+)([A-Z][a-z])/, "\\1_\\2")
name.gsub!(/([a-z\d])([A-Z])/, "\\1_\\2")
name.tr!("-", "_")
name.downcase!
end
|