Sha256: 20e5fae92fc07b06d9c36b2764ae83a41130f9867ff8e992c09e3ecb3caf72a2
Contents?: true
Size: 738 Bytes
Versions: 3
Compression:
Stored size: 738 Bytes
Contents
# frozen_string_literal: true # A module for style analysis and guidelines. module HeadMusic::Style; end # An analysis of music according to a style guide. class HeadMusic::Style::Analysis attr_reader :guide, :voice def initialize(guide, voice) @guide = guide @voice = voice end def messages annotations.reject(&:adherent?).map(&:message) end alias annotation_messages messages def annotations @annotations ||= @guide.analyze(voice) end def fitness return 1.0 if annotations.empty? @fitness ||= fitness_scores.inject(:+).to_f / fitness_scores.length end def adherent? fitness == 1 end private def fitness_scores @fitness_scores ||= annotations.map(&:fitness) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.20.0 | lib/head_music/style/analysis.rb |
head_music-0.19.2 | lib/head_music/style/analysis.rb |
head_music-0.19.1 | lib/head_music/style/analysis.rb |