Class: Pelusa::ClassAnalyzer
- Inherits:
-
Object
- Object
- Pelusa::ClassAnalyzer
- Defined in:
- lib/pelusa/class_analyzer.rb
Instance Method Summary collapse
-
#analyze(lints) ⇒ Object
Public: Analyzes a class with a series of lints.
-
#class_name ⇒ Object
Public: Returns the name of the Class being analyzed.
-
#initialize(klass) ⇒ ClassAnalyzer
constructor
Public: Initializes a ClassAnalyzer.
Constructor Details
#initialize(klass) ⇒ ClassAnalyzer
Public: Initializes a ClassAnalyzer.
klass - The class AST node.
5 6 7 |
# File 'lib/pelusa/class_analyzer.rb', line 5 def initialize(klass) @klass = klass end |
Instance Method Details
#analyze(lints) ⇒ Object
Public: Analyzes a class with a series of lints.
lints - The lints to check for.
Returns a collection of Analysis, one for each lint.
22 23 24 25 26 27 |
# File 'lib/pelusa/class_analyzer.rb', line 22 def analyze(lints) lints.map do |lint_class| lint = lint_class.new lint.check(@klass) end end |
#class_name ⇒ Object
Public: Returns the name of the Class being analyzed.
Returns the String name.
12 13 14 15 |
# File 'lib/pelusa/class_analyzer.rb', line 12 def class_name name = @klass.name name.name end |