Class: CompletenessFu::ScoringBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/completeness-fu/scoring_builder.rb

Overview

A simple clean room for setting up the completeness check information

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#cache_score_detailsObject

Returns the value of attribute cache_score_details.



6
7
8
# File 'lib/completeness-fu/scoring_builder.rb', line 6

def cache_score_details
  @cache_score_details
end

#completeness_checksObject

Returns the value of attribute completeness_checks.



6
7
8
# File 'lib/completeness-fu/scoring_builder.rb', line 6

def completeness_checks
  @completeness_checks
end

#default_weightingObject

Returns the value of attribute default_weighting.



6
7
8
# File 'lib/completeness-fu/scoring_builder.rb', line 6

def default_weighting
  @default_weighting
end

#model_weightingsObject

Returns the value of attribute model_weightings.



6
7
8
# File 'lib/completeness-fu/scoring_builder.rb', line 6

def model_weightings
  @model_weightings
end

Class Method Details

.generate(model, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/completeness-fu/scoring_builder.rb', line 8

def self.generate(model, &block)
  sb = ScoringBuilder.new
  
  sb.completeness_checks = []
  sb.default_weighting   = CompletenessFu.default_weighting
  sb.model_weightings    = CompletenessFu.common_weightings
  
  sb.instance_eval(&block)
  
  { :completeness_checks => sb.completeness_checks,
    :model_weightings    => sb.model_weightings,
    :cache_score_details => sb.cache_score_details,
    :default_weighting   => sb.default_weighting }     
end