Class: HeadMusic::Style::Guidelines::MinimumNotes
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::MinimumNotes
show all
- Defined in:
- lib/head_music/style/guidelines/minimum_notes.rb
Overview
Flags a melody with fewer than the required number of notes.
Configurable via the minimum: option; subclasses may set a MINIMUM_NOTES default.
Instance Method Summary
collapse
Instance Method Details
#deficiency_mark ⇒ Object
29
30
31
32
33
|
# File 'lib/head_music/style/guidelines/minimum_notes.rb', line 29
def deficiency_mark
return unless notes.length < minimum
HeadMusic::Style::Mark.for_all(placements, fitness: notes.length.to_f / minimum)
end
|
#marks ⇒ Object
7
8
9
|
# File 'lib/head_music/style/guidelines/minimum_notes.rb', line 7
def marks
placements.empty? ? no_placements_mark : deficiency_mark
end
|
#message ⇒ Object
11
12
13
|
# File 'lib/head_music/style/guidelines/minimum_notes.rb', line 11
def message
"Write at least #{minimum.humanize} notes."
end
|
#minimum ⇒ Object
17
18
19
|
# File 'lib/head_music/style/guidelines/minimum_notes.rb', line 17
def minimum
options.fetch(:minimum) { self.class::MINIMUM_NOTES }
end
|
#no_placements_mark ⇒ Object