Class: PerNodeSyncer

Inherits:
AbstractSyncer show all
Includes:
NodeAttrModule
Defined in:
lib/syncers/per_node_syncer.rb

Constant Summary

Constants included from NodeAttrModule

NodeAttrModule::ATTRS

Instance Method Summary collapse

Methods included from NodeAttrModule

remove_common_attr

Methods inherited from AbstractSyncer

#_fetch_html, #get_article_xpath, #initialize

Constructor Details

This class inherits a constructor from AbstractSyncer

Instance Method Details

#gen_htmlObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/syncers/per_node_syncer.rb', line 23

def gen_html
  article_nodes = self.get_article_nodes
  content = []
  article_nodes.each do |node|
    NodeAttrModule.remove_common_attr(node)
    content.append self._handle_node(node)
  end

  content.join("\n")
end

#get_article_nodesObject



17
18
19
20
21
# File 'lib/syncers/per_node_syncer.rb', line 17

def get_article_nodes
  page_html = self._fetch_html
  article = Nokogiri::HTML(page_html).xpath(self.get_article_xpath)
  article.children
end