Class: ImproveYourCode::Examiner

Inherits:
Object
  • Object
show all
Defined in:
lib/improve_your_code/examiner.rb

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Examiner

Returns a new instance of Examiner.



9
10
11
12
# File 'lib/improve_your_code/examiner.rb', line 9

def initialize(source)
  @source = Source::SourceCode.from(source)
  @smell_types = DetectorRepository.eligible_smell_types
end

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/improve_your_code/examiner.rb', line 14

def description
  @description ||= source.origin
end

#smellsObject



18
19
20
# File 'lib/improve_your_code/examiner.rb', line 18

def smells
  @smells ||= examine_tree.sort.uniq
end

#smells_countObject



22
23
24
# File 'lib/improve_your_code/examiner.rb', line 22

def smells_count
  smells.length
end

#smelly?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/improve_your_code/examiner.rb', line 26

def smelly?
  smells.any?
end