Class: GeneGenie::TemplateEvaluator
- Inherits:
-
Object
- Object
- GeneGenie::TemplateEvaluator
- Defined in:
- lib/gene_genie/template_evaluator.rb
Overview
A Template Evaluator provides certain analysis and useful information about templates
Instance Method Summary collapse
-
#initialize(template) ⇒ TemplateEvaluator
constructor
A new instance of TemplateEvaluator.
- #permutations ⇒ Object
-
#recommended_size ⇒ Object
returns a minimum of 10 unless the total number of permutations is below that otherwise, returns 1/1000th of the number of permutations up to a maximum of 1000.
Constructor Details
#initialize(template) ⇒ TemplateEvaluator
Returns a new instance of TemplateEvaluator.
6 7 8 |
# File 'lib/gene_genie/template_evaluator.rb', line 6 def initialize(template) @template = template end |
Instance Method Details
#permutations ⇒ Object
10 11 12 13 14 |
# File 'lib/gene_genie/template_evaluator.rb', line 10 def permutations @permutations ||= @template.map { |hash| hash.map { |_, v| v.size }.reduce(:*) }.reduce(:*) end |
#recommended_size ⇒ Object
returns a minimum of 10 unless the total number of permutations is below that otherwise, returns 1/1000th of the number of permutations up to a maximum of 1000
20 21 22 23 24 25 |
# File 'lib/gene_genie/template_evaluator.rb', line 20 def recommended_size [ [(permutations / 100_000), 5000].min, [10, permutations].min, ].max end |