Class: Musa::Transcription::FeatureTranscriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/musa-dsl/transcription/transcription.rb

Instance Method Summary collapse

Instance Method Details

#check(value_or_array, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/musa-dsl/transcription/transcription.rb', line 40

def check(value_or_array, &block)
  if block_given?
    if value_or_array.is_a?(Array)
      value_or_array.each(&block)
    else
      yield value_or_array
    end
  end
end

#transcript(element, base_duration:, tick_duration:) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/musa-dsl/transcription/transcription.rb', line 29

def transcript(element, base_duration:, tick_duration:)
  case element
  when Hash
    element.delete :modifiers if element[:modifiers]&.empty?
  when Array
    element.each { |_| _.delete :modifiers if _[:modifiers]&.empty? }
  end

  element
end