Class: Inch::Evaluation::Proxy Abstract
- Inherits:
-
Object
- Object
- Inch::Evaluation::Proxy
- Extended by:
- Forwardable
- Defined in:
- lib/inch/evaluation/proxy.rb
Overview
Base class for evaluations. This class provides the evaluation’s process structure.
Direct Known Subclasses
Language::Elixir::Evaluation::Base, Language::Nodejs::Evaluation::Base, Language::Ruby::Evaluation::Base
Constant Summary collapse
- MIN_SCORE =
0
- MAX_SCORE =
100
Instance Attribute Summary collapse
- #object ⇒ Codebase::Object readonly
- #roles ⇒ Array<Evaluation::Role::Base> readonly
Class Method Summary collapse
-
.for(language, object) ⇒ Evaluation::Proxy
Returns a Proxy object for the given
code_object
.
Instance Method Summary collapse
-
#evaluate ⇒ void
Evaluates the objects and assigns roles.
-
#initialize(object) ⇒ Proxy
constructor
A new instance of Proxy.
-
#max_score ⇒ Float
The max score that is assignable to
object
. -
#min_score ⇒ Float
The min score that is assignable to
object
. -
#priority ⇒ Fixnum
The priority for
object
. -
#score ⇒ Fixnum
The final score for
object
.
Constructor Details
#initialize(object) ⇒ Proxy
Returns a new instance of 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
#object ⇒ Codebase::Object (readonly)
25 26 27 |
# File 'lib/inch/evaluation/proxy.rb', line 25 def object @object end |
#roles ⇒ Array<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
#evaluate ⇒ void
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_score ⇒ Float
Returns the max score that is assignable to object
.
47 48 49 |
# File 'lib/inch/evaluation/proxy.rb', line 47 def max_score @__max_score = __max_score end |
#min_score ⇒ Float
Returns the min score that is assignable to object
.
52 53 54 |
# File 'lib/inch/evaluation/proxy.rb', line 52 def min_score @__min_score = __min_score end |
#priority ⇒ Fixnum
Returns the priority for object
.
62 63 64 |
# File 'lib/inch/evaluation/proxy.rb', line 62 def priority @__priority ||= __priority end |
#score ⇒ Fixnum
Returns the final score for object
.
57 58 59 |
# File 'lib/inch/evaluation/proxy.rb', line 57 def score @__score ||= __score end |