Class: Inch::Evaluation::Proxy Abstract

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/inch/evaluation/proxy.rb

Overview

This class is abstract.

Base class for evaluations. This class provides the evaluation's process structure.

Constant Summary collapse

MIN_SCORE =
0
MAX_SCORE =
100

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Proxy


31
32
33
34
35
36
37
# File 'lib/inch/evaluation/proxy.rb', line 31

def initialize(object)
  @object = object
  evaluation_config = Config.for(object.language).evaluation
  @criteria = eval_criteria(evaluation_config)
  @roles = []
  evaluate
end

Instance Attribute Details

#objectCodebase::Object (readonly)


25
26
27
# File 'lib/inch/evaluation/proxy.rb', line 25

def object
  @object
end

#rolesArray<Evaluation::Role::Base> (readonly)


28
29
30
# File 'lib/inch/evaluation/proxy.rb', line 28

def roles
  @roles
end

Class Method Details

.for(language, object) ⇒ Evaluation::Proxy

Returns a Proxy object for the given code_object


15
16
17
# File 'lib/inch/evaluation/proxy.rb', line 15

def self.for(language, object)
  class_for(language, object.code_object).new(object)
end

Instance Method Details

#evaluatevoid

Note:

This is its own method so it can be overridden.

This method returns an undefined value.

Evaluates the objects and assigns roles


42
43
44
# File 'lib/inch/evaluation/proxy.rb', line 42

def evaluate
  __evaluate(object, relevant_roles)
end

#max_scoreFloat


47
48
49
# File 'lib/inch/evaluation/proxy.rb', line 47

def max_score
  @__max_score = __max_score
end

#min_scoreFloat


52
53
54
# File 'lib/inch/evaluation/proxy.rb', line 52

def min_score
  @__min_score = __min_score
end

#priorityFixnum


62
63
64
# File 'lib/inch/evaluation/proxy.rb', line 62

def priority
  @__priority ||= __priority
end

#scoreFixnum


57
58
59
# File 'lib/inch/evaluation/proxy.rb', line 57

def score
  @__score ||= __score
end