Class: Lydown::Rendering::Grace

Inherits:
Base
  • Object
show all
Defined in:
lib/lydown/rendering/music.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#find_prev_event, #initialize, #next_event, #prev_event

Constructor Details

This class inherits a constructor from Lydown::Rendering::Base

Class Method Details

.emit_grace_end(context) ⇒ Object



90
91
92
# File 'lib/lydown/rendering/music.rb', line 90

def self.emit_grace_end(context)
  context.emit(:music, '} ')
end

Instance Method Details

#translateObject



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/lydown/rendering/music.rb', line 94

def translate
  # close tuplet braces
  if @context['process/grace_mode']
    Grace.emit_grace_end(@context)
    @context['process/grace_mode'] = nil
  end

  value = LILYPOND_DURATIONS[@event[:value]] || @event[:value]

  @context['process/duration_values'] = [value]
  @context['process/last_value'] = nil
  @context['process/grace_mode'] = true
  
  @context.emit(:music, "\\#{@event[:kind]} { ")
end