class MusicalScore::Note::Lyric
Attributes
is_extend[RW]
syllabic[RW]
text[RW]
Public Class Methods
create_by_hash(doc)
click to toggle source
# File lib/musical_score/note/lyric.rb, line 29 def self.create_by_hash(doc) syllabic = doc.has_key?("syllabic") ? doc["syllabic"][0].to_sym : nil text = doc["text"][0] is_extend = doc.has_key?("extend") return MusicalScore::Note::Lyric.new(text, syllabic, is_extend) end
create_by_xml(xml_doc)
click to toggle source
# File lib/musical_score/note/lyric.rb, line 21 def self.create_by_xml(xml_doc) syllabic = xml_doc.elements["syllabic"] ? xml_doc.elements["syllabic"].text.to_sym : nil text = xml_doc.elements["text"].text is_extend = xml_doc.elements["extend"] ? true : false return MusicalScore::Note::Lyric.new(text, syllabic, is_extend) end
new(text, syllabic, is_extend = false)
click to toggle source
# File lib/musical_score/note/lyric.rb, line 15 def initialize(text, syllabic, is_extend = false) @text = text @syllabic = syllabic @is_extend = is_extend end
Public Instance Methods
export_xml(number)
click to toggle source
# File lib/musical_score/note/lyric.rb, line 36 def export_xml(number) lyric_element = REXML::Element.new('lyric') lyric_element.add_attribute('number', number.to_s) text_element = REXML::Element.new('text').add_text(@text.to_s) if (@syllabic) syllabic_element = REXML::Element.new('syllabic').add_text(@syllabic.to_s) lyric_element.add_element(syllabic_element) end lyric_element.add_element(text_element) return lyric_element end