Class: HeadMusic::Style::Guidelines::MaximumNotes
- Inherits:
-
Annotation
- Object
- Annotation
- HeadMusic::Style::Guidelines::MaximumNotes
show all
- Defined in:
- lib/head_music/style/guidelines/maximum_notes.rb
Overview
Flags a melody with more than the allowed number of notes.
Configurable via the maximum: option; subclasses may set a MAXIMUM_NOTES default.
Instance Method Summary
collapse
Instance Method Details
#marks ⇒ Object
7
8
9
|
# File 'lib/head_music/style/guidelines/maximum_notes.rb', line 7
def marks
HeadMusic::Style::Mark.for_each(notes[maximum..]) if overage.positive?
end
|
#maximum ⇒ Object
17
18
19
|
# File 'lib/head_music/style/guidelines/maximum_notes.rb', line 17
def maximum
options.fetch(:maximum) { self.class::MAXIMUM_NOTES }
end
|
#message ⇒ Object
11
12
13
|
# File 'lib/head_music/style/guidelines/maximum_notes.rb', line 11
def message
"Write up to #{maximum.humanize} notes."
end
|
#overage ⇒ Object
21
22
23
|
# File 'lib/head_music/style/guidelines/maximum_notes.rb', line 21
def overage
[notes.length - maximum, 0].max
end
|