Class: Inch::Evaluation::ConstantObject

Inherits:
Base
  • Object
show all
Defined in:
lib/inch/evaluation/constant_object.rb

Constant Summary collapse

DOC_SCORE =
MAX_SCORE

Constants inherited from Base

Base::MAX_SCORE, Base::MIN_SCORE, Base::TAGGED_SCORE

Instance Attribute Summary

Attributes inherited from Base

#max_score, #min_score, #object

Instance Method Summary collapse

Methods inherited from Base

#initialize, #priority, #roles, #score

Constructor Details

This class inherits a constructor from Inch::Evaluation::Base

Instance Method Details

#evaluateObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/inch/evaluation/constant_object.rb', line 6

def evaluate
  if object.has_doc?
    add_role Role::Constant::WithDoc.new(object, DOC_SCORE)
  else
    add_role Role::Constant::WithoutDoc.new(object, DOC_SCORE)
  end
  if object.nodoc?
    add_role Role::Constant::TaggedAsNodoc.new(object)
  end
  if object.has_unconsidered_tags?
    count = object.unconsidered_tags.size
    add_role Role::Object::Tagged.new(object, TAGGED_SCORE * count)
  end
  if object.in_root?
    add_role Role::Constant::InRoot.new(object)
  end
  if object.public?
    add_role Role::Constant::Public.new(object)
  end
  if object.protected?
    add_role Role::Constant::Protected.new(object)
  end
  if object.private?
    add_role Role::Constant::Private.new(object)
  end
end