Class: WTFChord::Formatters::Piano
- Defined in:
- lib/wtf_chord/formatters/piano.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, #keys, separator, to_proc, with_rates, #with_rates?
Constructor Details
This class inherits a constructor from WTFChord::Formatters::Base
Instance Method Details
#draw ⇒ Object
8 9 10 11 12 13 |
# File 'lib/wtf_chord/formatters/piano.rb', line 8 def draw [ unique_notes.sort.join(" - "), Keyboard.press(*unique_notes.map(&:position)) ].join("\n\n") end |
#unique_notes ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/wtf_chord/formatters/piano.rb', line 15 def unique_notes strings.reject(&:dead?).each_with_object([[], []]) do |string, (positions, notes)| unless positions.include?(string.note.position) positions << string.note.position notes << string.note end end[1] end |