lib/head_music/style/analysis.rb in head_music-0.19.0 vs lib/head_music/style/analysis.rb in head_music-0.19.1
- old
+ new
@@ -1,25 +1,25 @@
# frozen_string_literal: true
-# A module for style analysis and rules.
+# A module for style analysis and guidelines.
module HeadMusic::Style; end
-# An analysis of music according to a ruleset.
+# An analysis of music according to a style guide.
class HeadMusic::Style::Analysis
- attr_reader :ruleset, :subject
+ attr_reader :guide, :voice
- def initialize(ruleset, subject)
- @ruleset = ruleset
- @subject = subject
+ def initialize(guide, voice)
+ @guide = guide
+ @voice = voice
end
def messages
annotations.reject(&:adherent?).map(&:message)
end
alias annotation_messages messages
def annotations
- @annotations ||= @ruleset.analyze(subject)
+ @annotations ||= @guide.analyze(voice)
end
def fitness
return 1.0 if annotations.empty?
@fitness ||= fitness_scores.inject(:+).to_f / fitness_scores.length