Method: Pslm::PsalmPatterns#tone_data

Defined in:
lib/pslm/psalmpatterns.rb

#tone_data(tone, difference = '') ⇒ Object

returns an Array like [[1,2], [2,0]] specifying number of accents and



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/pslm/psalmpatterns.rb', line 49

def tone_data(tone, difference='')
  tone.downcase!
  difference.downcase!

  unless @data.has_key? tone
    raise ToneError.new "Unknown tone '#{tone}'"
  end

  if @data[tone][1][1].is_a? Hash then
    unless @data[tone][1][1].has_key? difference
      raise DifferenceError.new "Unknown difference '#{difference}' for tone '#{tone}'"
    end

    return [ @data[tone][0].dup , [ @data[tone][1][0], @data[tone][1][1][difference] ] ]
  else
    return @data[tone]
  end
end