Class: Inch::Evaluation::MethodObject

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

Constant Summary collapse

DOC_SCORE =
50
EXAMPLE_SCORE =
10
MULTIPLE_EXAMPLES_SCORE =
25
PARAM_SCORE =
40
RETURN_SCORE =
10

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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/inch/evaluation/method_object.rb', line 10

def evaluate
  eval_doc
  eval_parameters
  eval_return_type
  eval_code_example

  if object.overridden?
    add_role Role::Method::Overridden.new(object, object.overridden_method.score)
  end
  if object.has_many_lines?
    add_role Role::Method::WithManyLines.new(object)
  end
  if object.bang_name?
    add_role Role::Method::WithBangName.new(object)
  end
  if object.questioning_name?
    add_role Role::Method::WithQuestioningName.new(object)
  end
  if object.has_alias?
    add_role Role::Method::HasAlias.new(object)
  end
  if object.nodoc?
    add_role Role::Object::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::Object::InRoot.new(object)
  end
  if object.public?
    add_role Role::Object::Public.new(object)
  end
  if object.protected?
    add_role Role::Object::Protected.new(object)
  end
  if object.private?
    add_role Role::Object::Private.new(object)
  end
end