class MusicalScore::Score::Identification::Identification

Attributes

creators[R]
encoding[R]

Public Class Methods

create_by_hash(doc) click to toggle source
# File lib/musical_score/score/identification/identification.rb, line 36
def self.create_by_hash(doc)
    creators = Array.new
    if (doc.has_key?("creator"))
        doc["creator"].each do |element|
            creators.push(MusicalScore::Score::Identification::Creator.create_by_hash(element))
        end
    end
    encoding = doc.has_key?("encoding") ? MusicalScore::Score::Identification::Encoding.create_by_hash(doc["encoding"][0]) : nil
    return MusicalScore::Score::Identification::Identification.new(creators, encoding)
end
create_by_xml(xml_doc) click to toggle source
# File lib/musical_score/score/identification/identification.rb, line 21
def self.create_by_xml(xml_doc)
    creator_doc  = xml_doc.elements["//creator"]
    encoding_doc = xml_doc.elements["//encoding"]

    creators = Array.new
    xml_doc.elements.each("//creator") do |element|
        creators.push(MusicalScore::Score::Identification::Creator.create_by_xml(element))
    end

    encoding = encoding_doc ? MusicalScore::Score::Identification::Encoding.create_by_xml(encoding_doc) : nil

    return MusicalScore::Score::Identification::Identification.new(creators, encoding)
end
new(creators, encodings) click to toggle source
# File lib/musical_score/score/identification/identification.rb, line 15
def initialize(creators, encodings)
    @creators = creators
    @encoding = encodings
end

Public Instance Methods

export_xml() click to toggle source
# File lib/musical_score/score/identification/identification.rb, line 47
def export_xml
    identification = REXML::Element.new('identification')
    @creators.each do |creator|
        identification.add_element(creator.export_xml)
    end
    identification.add_element(@encoding.export_xml)

    return identification
end