lib/zci/import.rb in zci-0.9.0 vs lib/zci/import.rb in zci-0.10.0

- old
+ new

@@ -1,9 +1,8 @@ module ZCI - def build_category_xml(category) - category_xml = Nokogiri::XML::Builder.new do |xml| + Nokogiri::XML::Builder.new do |xml| xml.root { xml.category(id: category.id, position: category.position, identifier: 'category', type: 'document') { xml.name { xml.cdata category.name } @@ -11,25 +10,23 @@ xml.cdata category.description } } } end - - return category_xml end def build_category_hash(category) - return { + { id: category.id, position: category.position, name: category.name, description: category.description, } end def build_section_xml(section) - section_xml = Nokogiri::XML::Builder.new do |xml| + Nokogiri::XML::Builder.new do |xml| xml.root { # id - id of the original section # category_id - id of the original category xml.section(id: section.id, category_id: section.category_id, position: section.position, identifier: 'section', type: 'document') { xml.name { @@ -39,16 +36,14 @@ xml.cdata section.description } } } end - - return section_xml end def build_section_hash(section) - return { + { id: section.id, category_id: section.category_id, position: section.position, name: section.name, description: section.description, @@ -58,11 +53,11 @@ def build_article_xml(article) # remove control chars, unicode codepoints from 0001 to 001A article.title.to_s.gsub!(/[\u0001-\u001A]/ , '') article.body.to_s.gsub!(/[\u0001-\u001A]/ , '') - article_xml = Nokogiri::XML::Builder.new do |xml| + Nokogiri::XML::Builder.new do |xml| xml.root { # id - id of the original acticle # section_id - id of the original section xml.article(id: article.id, section_id: article.section_id, position: article.position, identifier: 'article', type: 'document') { xml.title { @@ -72,20 +67,17 @@ xml.cdata article.body } } } end - - return article_xml end def build_article_hash(article) - return { + { id: article.id, section_id: article.section_id, position: article.position, title: article.title, body: article.body, } end - end