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
- TAGGED_SCORE =
assigned per unconsidered tag
20
Class Attribute Summary collapse
-
.criteria_map ⇒ Object
readonly
Returns the value of attribute criteria_map.
Instance Attribute Summary collapse
-
#max_score ⇒ Float
readonly
The max score that is assignable to
object
. -
#min_score ⇒ Float
readonly
The min score that is assignable to
object
. - #object ⇒ CodeObject::Proxy::Base
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.
-
#priority ⇒ Fixnum
The priority for
object
. - #roles ⇒ Array<Evaluation::Role::Base>
-
#score ⇒ Float
The final score for
object
.
Constructor Details
#initialize(object) ⇒ Base
Returns a new instance of Base.
42 43 44 45 46 |
# File 'lib/inch/evaluation/proxy/base.rb', line 42 def initialize(object) self.object = object @roles = [] evaluate end |
Class Attribute Details
.criteria_map ⇒ Object (readonly)
Returns the value of attribute criteria_map.
19 20 21 |
# File 'lib/inch/evaluation/proxy/base.rb', line 19 def criteria_map @criteria_map end |
Instance Attribute Details
#max_score ⇒ Float (readonly)
Returns the max score that is assignable to object
.
54 55 56 |
# File 'lib/inch/evaluation/proxy/base.rb', line 54 def max_score @max_score end |
#min_score ⇒ Float (readonly)
Returns the min score that is assignable to object
.
59 60 61 |
# File 'lib/inch/evaluation/proxy/base.rb', line 59 def min_score @min_score end |
#object ⇒ CodeObject::Proxy::Base
14 15 16 |
# File 'lib/inch/evaluation/proxy/base.rb', line 14 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
35 36 37 38 |
# File 'lib/inch/evaluation/proxy/base.rb', line 35 def criteria(&block) @criteria_map ||= {} @criteria_map[to_s] ||= ObjectSchema.new(&block) end |
Instance Method Details
#evaluate ⇒ Object
Evaluates the objects and assigns roles
49 50 51 |
# File 'lib/inch/evaluation/proxy/base.rb', line 49 def evaluate __evaluate(object, relevant_roles) end |
#priority ⇒ Fixnum
Returns the priority for object
.
69 70 71 |
# File 'lib/inch/evaluation/proxy/base.rb', line 69 def priority @__priority ||= __priority end |
#roles ⇒ Array<Evaluation::Role::Base>
74 75 76 |
# File 'lib/inch/evaluation/proxy/base.rb', line 74 def roles @roles end |
#score ⇒ Float
Returns the final score for object
.
64 65 66 |
# File 'lib/inch/evaluation/proxy/base.rb', line 64 def score @__score ||= __score end |