Class: HeadMusic::Style::Guidelines::MinimumMelodicIntervals
- Inherits:
-
MinimumThreshold
- Object
- HeadMusic::Style::Guideline
- MinimumThreshold
- HeadMusic::Style::Guidelines::MinimumMelodicIntervals
- Defined in:
- lib/head_music/style/guidelines/minimum_melodic_intervals.rb
Overview
Flags a melody with fewer than the required number of moving melodic intervals. Repeated-note pairs don’t count as motion, so an all-repeated-note line gates to 0. Configure the threshold with the factory, e.g. MinimumMelodicIntervals.with(2).
Class Method Summary collapse
-
.template_values(config) ⇒ Object
The count comes from the configuration or the class default – never from config alone, which is empty for the unconfigured case.
Instance Method Summary collapse
-
#actual_count ⇒ Object
private
-
#marks ⇒ Object
-
#moving_intervals ⇒ Object
private
-
#no_motion_mark ⇒ Object
private
Constructor Details
This class inherits a constructor from HeadMusic::Style::Guideline
Class Method Details
.template_values(config) ⇒ Object
The count comes from the configuration or the class default – never from config alone, which is empty for the unconfigured case.
16 17 18 19 |
# File 'lib/head_music/style/guidelines/minimum_melodic_intervals.rb', line 16 def self.template_values(config) count = config.fetch(:minimum) {count: count, number: HeadMusic::Style::Template.number_word(count)} end |
Instance Method Details
#actual_count ⇒ Object (private)
33 34 35 |
# File 'lib/head_music/style/guidelines/minimum_melodic_intervals.rb', line 33 def actual_count moving_intervals.length end |
#marks ⇒ Object
8 9 10 11 12 |
# File 'lib/head_music/style/guidelines/minimum_melodic_intervals.rb', line 8 def marks return no_motion_mark if moving_intervals.empty? deficiency_mark end |
#moving_intervals ⇒ Object (private)
23 24 25 |
# File 'lib/head_music/style/guidelines/minimum_melodic_intervals.rb', line 23 def moving_intervals melodic_intervals.select(&:moving?) end |