Class | Core::Providers::Multiverse::Parsers::MetaSectionParser |
In: |
core/serviceproviders/multiverse/parsers/meta_section_parser.rb
|
Parent: | Object |
Check that the required meta tags are present in the document.
# File core/serviceproviders/multiverse/parsers/meta_section_parser.rb, line 27 def check(document) if ( document.root.elements['meta/name'].nil? ) raise Core::Exceptions::Multiverse::UniverseParsingException.new('Required <name> tag not found inside the <meta> section.') end if ( document.root.elements['meta/uid'].nil? ) raise Core::Exceptions::Multiverse::UniverseParsingException.new('Required <uid> tag not found inside the <meta> section.') end if ( document.root.elements['meta/uid'].text.nil? ) raise Core::Exceptions::Multiverse::UniverseParsingException.new('<uid> value is not meaningful.') end if ( document.root.elements['meta/creator'] ) creatortag = document.root.elements['meta/creator'] if ( creatortag.attributes['name'].nil? && creatortag.attributes['email'].nil? ) raise Core::Exceptions::Multiverse::UniverseParsingException.new('<creator> tag needs at least a name or an email attribute.') end end end
Parse the meta section of the document and return a hash containing all the information
# File core/serviceproviders/multiverse/parsers/meta_section_parser.rb, line 49 def parse(document, universe) universe.meta = {} metaroot = document.root.elements['meta'] metaroot.elements.each do |m| key = m.name.to_sym if (:creator == key) universe.meta[key] = {} m.attributes.each do |name, value| universe.meta[key][name.to_sym] = value end else universe.meta[key] = m.text end end end