4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/rss-motor/rss-proc.rb', line 4
def self.(items, more_nodes=[], more_node_keys={})
= []
[items].flatten.each_with_index do |item, idx|
item_splitd = XMLMotor.splitter item
item_tags = XMLMotor.indexify item_splitd
title = XMLMotor.xmldata item_splitd, item_tags, 'title'
link = XMLMotor.xmldata item_splitd, item_tags, 'link'
guid = XMLMotor.xmldata item_splitd, item_tags, 'guid'
description = XMLMotor.xmldata item_splitd, item_tags, 'description'
pubDate = XMLMotor.xmldata item_splitd, item_tags, 'pubDate'
author = XMLMotor.xmldata item_splitd, item_tags, 'author'
enclosure = XMLMotor.xmlattrib 'url', item_splitd, item_tags, 'enclosure'
[idx] = {
'title' => title.join,
'link' => link.join,
'guid' => guid.join,
'description' => description.join,
'date' => pubDate.join,
'author' => author.join,
'enclosure' => enclosure.join
}
[more_nodes].flatten.each do |node|
[idx][node] = XMLMotor.xmldata(item_splitd, item_tags, node).join unless node.nil?
end
if more_node_keys.is_a? Hash
more_node_keys.each_pair do |node, key|
[idx]["#{node}:#{key}"] = XMLMotor.xmlattrib(key, item_splitd, item_tags, node).join
end
end
end
return
end
|