Class: Inch::Evaluation::Role::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/inch/evaluation/role/base.rb

Overview

This class is abstract.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, value = nil) ⇒ Base

Returns a new instance of Base.



10
11
12
13
# File 'lib/inch/evaluation/role/base.rb', line 10

def initialize(object, value = nil)
  @object = object
  @value = value
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



8
9
10
# File 'lib/inch/evaluation/role/base.rb', line 8

def object
  @object
end

Instance Method Details

#max_scoreFloat

Note:

Override this method to that a max_score for the evaluation.

Returns a maximal score for the object. The final score can not be higher than this.

Returns:

  • (Float)


19
20
# File 'lib/inch/evaluation/role/base.rb', line 19

def max_score
end

#min_scoreFloat

Note:

Override this method to that a min_score for the evaluation.

Returns a minimal score for the object. The final score can not be lower than this.

Returns:

  • (Float)


26
27
# File 'lib/inch/evaluation/role/base.rb', line 26

def min_score
end

#object_typeObject



67
68
69
# File 'lib/inch/evaluation/role/base.rb', line 67

def object_type
  object.class.to_s.split('::').last.gsub(/Object$/, '').downcase
end

#potential_scoreFloat

Note:

Override this method to assign a potential score for the role

Returns a potential score that would be added to the overall score if the object had implemented the Role’s subject.

Returns:

  • (Float)

See Also:



44
45
46
# File 'lib/inch/evaluation/role/base.rb', line 44

def potential_score
  nil
end

#priorityFixnum

Note:

Override this method to assign a priority for the role

Returns a priority that will be added to the associated object’s overall priority.

Returns:

  • (Fixnum)


53
54
55
# File 'lib/inch/evaluation/role/base.rb', line 53

def priority
  0
end

#scoreFloat

Note:

Override this method to assign a score for the role

Returns a score that will be added to the associated object’s overall score.

Returns:

  • (Float)


34
35
36
# File 'lib/inch/evaluation/role/base.rb', line 34

def score
  @value.to_f
end

#suggestionFloat

Returns a suggestion to achieve the potential score that would be added to the overall score if the object had implemented the Role’s subject.

Returns:

  • (Float)

See Also:



63
64
65
# File 'lib/inch/evaluation/role/base.rb', line 63

def suggestion
  nil
end