Class: Inch::Evaluation::Proxy::Base Abstract
- Inherits:
-
Object
- Object
- Inch::Evaluation::Proxy::Base
- Extended by:
- Forwardable
- Defined in:
- lib/inch/evaluation/proxy/base.rb
Overview
This class is abstract.
Direct Known Subclasses
Constant Summary collapse
- MIN_SCORE =
0
- MAX_SCORE =
100
Class Attribute Summary collapse
-
.criteria_map ⇒ Object
readonly
Returns the value of attribute criteria_map.
Instance Attribute Summary collapse
Class Method Summary collapse
-
.criteria(&block) ⇒ void
Defines the weights during evaluation for different criteria.
Instance Method Summary collapse
-
#evaluate ⇒ Object
Evaluates the objects and assigns roles.
-
#initialize(object) ⇒ Base
constructor
A new instance of Base.
-
#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
. - #roles ⇒ Array<Evaluation::Role::Base>
-
#score ⇒ Fixnum
The final score for
object
.
Constructor Details
#initialize(object) ⇒ Base
Returns a new instance of Base.
38 39 40 41 42 |
# File 'lib/inch/evaluation/proxy/base.rb', line 38 def initialize(object) self.object = object @roles = [] evaluate end |
Class Attribute Details
.criteria_map ⇒ Object (readonly)
Returns the value of attribute criteria_map.
15 16 17 |
# File 'lib/inch/evaluation/proxy/base.rb', line 15 def criteria_map @criteria_map end |
Instance Attribute Details
#object ⇒ CodeObject::Proxy::Base
12 13 14 |
# File 'lib/inch/evaluation/proxy/base.rb', line 12 def object @object end |
Class Method Details
.criteria(&block) ⇒ void
This method returns an undefined value.
Defines the weights during evaluation for different criteria
MethodObject.criteria do
docstring 0.5
parameters 0.4
return_type 0.1
if object.constructor?
parameters 0.5
return_type 0.0
end
end
31 32 33 34 |
# File 'lib/inch/evaluation/proxy/base.rb', line 31 def criteria(&block) @criteria_map ||= {} @criteria_map[to_s] ||= ObjectSchema.new(&block) end |
Instance Method Details
#evaluate ⇒ Object
Evaluates the objects and assigns roles
45 46 47 |
# File 'lib/inch/evaluation/proxy/base.rb', line 45 def evaluate __evaluate(object, relevant_roles) end |
#max_score ⇒ Float
Returns the max score that is assignable to object
.
50 51 52 |
# File 'lib/inch/evaluation/proxy/base.rb', line 50 def max_score @__max_score = __max_score end |
#min_score ⇒ Float
Returns the min score that is assignable to object
.
55 56 57 |
# File 'lib/inch/evaluation/proxy/base.rb', line 55 def min_score @__min_score = __min_score end |
#priority ⇒ Fixnum
Returns the priority for object
.
65 66 67 |
# File 'lib/inch/evaluation/proxy/base.rb', line 65 def priority @__priority ||= __priority end |
#roles ⇒ Array<Evaluation::Role::Base>
70 71 72 |
# File 'lib/inch/evaluation/proxy/base.rb', line 70 def roles @roles end |
#score ⇒ Fixnum
Returns the final score for object
.
60 61 62 |
# File 'lib/inch/evaluation/proxy/base.rb', line 60 def score @__score ||= __score end |