Class: Inch::Evaluation::Role::Base
- Inherits:
-
Object
- Object
- Inch::Evaluation::Role::Base
- Defined in:
- lib/inch/evaluation/role/base.rb
Direct Known Subclasses
Method::HasAlias, Method::Overridden, Method::WithBangName, Method::WithManyLines, Method::WithManyParameters, Method::WithReturnType, Method::WithoutParameters, MethodParameter::Block, MethodParameter::Splat, MethodParameter::WithBadName, MethodParameter::WithMention, MethodParameter::WithType, Missing, Namespace::Core, Namespace::Pure, Namespace::WithChildren, Namespace::WithManyAttributes, Namespace::WithManyChildren, Namespace::WithoutChildren, Namespace::WithoutMethods, Object::InRoot, Object::Private, Object::Protected, Object::Public, Object::Tagged, Object::TaggedAsNodoc, Object::WithCodeExample, Object::WithDoc, Object::WithMultipleCodeExamples
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
-
#initialize(object, value = nil) ⇒ Base
constructor
A new instance of Base.
-
#max_score ⇒ Object
Override this method to that a max_score for the evaluation.
-
#min_score ⇒ Object
Override this method to that a min_score for the evaluation.
- #object_type ⇒ Object
-
#potential_score ⇒ Float
A score that can be achieved by adding the missing thing mentioned by the role.
- #priority ⇒ Object
-
#score ⇒ Object
Returns a score that will be added to the associated object’s overall score.
- #suggestion ⇒ Object
Constructor Details
#initialize(object, value = nil) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/inch/evaluation/role/base.rb', line 7 def initialize(object, value = nil) @object = object @value = value end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/inch/evaluation/role/base.rb', line 5 def object @object end |
Instance Method Details
#max_score ⇒ Object
Override this method to that a max_score for the evaluation.
13 14 |
# File 'lib/inch/evaluation/role/base.rb', line 13 def max_score end |
#min_score ⇒ Object
Override this method to that a min_score for the evaluation.
17 18 |
# File 'lib/inch/evaluation/role/base.rb', line 17 def min_score end |
#object_type ⇒ Object
43 44 45 |
# File 'lib/inch/evaluation/role/base.rb', line 43 def object_type object.class.to_s.split('::').last.gsub(/Object$/, '').downcase end |
#potential_score ⇒ Float
Returns a score that can be achieved by adding the missing thing mentioned by the role.
31 32 33 |
# File 'lib/inch/evaluation/role/base.rb', line 31 def potential_score nil end |
#priority ⇒ Object
35 36 37 |
# File 'lib/inch/evaluation/role/base.rb', line 35 def priority 0 end |
#score ⇒ Object
Returns a score that will be added to the associated object’s overall score.
Override this method to that a score for the role.
24 25 26 |
# File 'lib/inch/evaluation/role/base.rb', line 24 def score @value.to_f end |
#suggestion ⇒ Object
39 40 41 |
# File 'lib/inch/evaluation/role/base.rb', line 39 def suggestion nil end |