Class: Lydown::Translation::Ripple::Note::Head
- Inherits:
-
Root
- Object
- Treetop::Runtime::SyntaxNode
- Root
- Lydown::Translation::Ripple::Note::Head
- Defined in:
- lib/lydown/translation/ripple/nodes.rb
Instance Method Summary collapse
Methods inherited from Root
#_translate, #check_line_break, #source_line
Instance Method Details
#translate(note, opts) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/lydown/translation/ripple/nodes.rb', line 90 def translate(note, opts) head = text_value.dup head.gsub!(/(?<=.{1})b/, '-') head.gsub!(/(?<=.{1})es/, '-') head.gsub!(/(?<=.{1})s/, '+') head.sub!(/([a-g][\+\-]*)/) do |m| Lydown::Rendering::Accidentals.chromatic_to_diatonic( m, opts[:key] || 'c major' ) end note[:head] = head end |