Class: Fretboard::Note
- Inherits:
-
Object
- Object
- Fretboard::Note
- Defined in:
- lib/fretboard/note.rb
Class Method Summary collapse
Class Method Details
.next_for(note, sharp_or_flat: :both) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fretboard/note.rb', line 5 def self.next_for(note, sharp_or_flat: :both) all_notes = Fretboard::Notes.all(sharp_or_flat) note = Fretboard::NoteFormatter.format(note, sharp_or_flat:) current_index = all_notes.find_index(note) raise Fretboard::Exceptions::UnknownNote, note if current_index.nil? next_index = current_index + 1 next_note = all_notes[next_index] next_note = all_notes.first if next_note.nil? next_note end |