Class: Pelusa::ClassAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/pelusa/class_analyzer.rb

Instance Method Summary collapse

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_nameObject

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