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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#objectObject (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_scoreObject

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_scoreObject

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_typeObject



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_scoreFloat

Returns a score that can be achieved by adding the missing thing mentioned by the role.

Returns:

  • (Float)

    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

#priorityObject



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

def priority
  0
end

#scoreObject

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

#suggestionObject



39
40
41
# File 'lib/inch/evaluation/role/base.rb', line 39

def suggestion
  nil
end