lib/head_music/style/analysis.rb in head_music-0.16.0 vs lib/head_music/style/analysis.rb in head_music-0.16.2

- old
+ new

@@ -17,20 +17,20 @@ @annotations ||= @ruleset.analyze(subject) end def fitness return 1.0 if annotations.length == 0 - fitness_scores.inject(:+).to_f / fitness_scores.length + @fitness ||= fitness_scores.inject(:+).to_f / fitness_scores.length end def adherent? fitness == 1 end private def fitness_scores - annotations.map(&:fitness) + @fitness_scores ||= annotations.map(&:fitness) end end end end