rss_creator 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rss_creator.rb +15 -11
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c55bbb375aff51662e10d1254184218dede57bf
|
4
|
+
data.tar.gz: d646cecb9d7ce17567b596f27a22ebb653ab982c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51df9b21a6631b9743afa2cba300eac7099061980d1806ee98488043169197fa94fddb1d033f1b801fd85d37248131f28649c986d36a13a1f482b62f38d07a6a
|
7
|
+
data.tar.gz: 3b021bdecd968143e95ea573c730b79d7a4baf254c1da54037ce0d635c51b55d92f54b427ee2b6ce73a3616667e69bf9d136621e05d336530380d845321429cf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rss_creator.rb
CHANGED
@@ -8,7 +8,7 @@ require 'rss_to_dynarex'
|
|
8
8
|
|
9
9
|
class RSScreator
|
10
10
|
|
11
|
-
attr_accessor :title, :description, :limit
|
11
|
+
attr_accessor :title, :description, :link, :limit
|
12
12
|
|
13
13
|
def initialize(filepath=nil)
|
14
14
|
|
@@ -20,16 +20,17 @@ class RSScreator
|
|
20
20
|
@dx = rtd.to_dynarex
|
21
21
|
@title = @dx.title
|
22
22
|
@description = @dx.description
|
23
|
+
@link = @dx.link
|
23
24
|
|
24
25
|
else
|
25
|
-
@dx = Dynarex.new 'channel[title,description
|
26
|
+
@dx = Dynarex.new 'channel[title, description, link]/' + \
|
27
|
+
'item(title, link, description, date)'
|
26
28
|
@dx.order = 'descending'
|
27
29
|
end
|
28
30
|
|
29
|
-
@dx.xslt_schema = 'channel[title:title,description:description
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
@dx.xslt_schema = 'channel[title:title,description:description,' + \
|
32
|
+
'link:link]/item(title:title,description:description,' + \
|
33
|
+
'link:link,pubDate:date)'
|
33
34
|
# maxium number of items saved in the RSS feed
|
34
35
|
@limit = 11
|
35
36
|
|
@@ -37,8 +38,11 @@ class RSScreator
|
|
37
38
|
|
38
39
|
def add(item={title: '', link: '', description: ''})
|
39
40
|
|
40
|
-
|
41
|
-
|
41
|
+
unless item[:title] and item[:link] then
|
42
|
+
raise 'RSScreator: title or link can\'t be blank'
|
43
|
+
end
|
44
|
+
|
45
|
+
record = {date: Time.now.strftime("%a, %d %b %Y %H:%M:%S %z")}.merge(item)
|
42
46
|
@dx.create record
|
43
47
|
end
|
44
48
|
|
@@ -60,11 +64,11 @@ class RSScreator
|
|
60
64
|
|
61
65
|
def print_rss()
|
62
66
|
|
63
|
-
if @title.nil? or @description.nil?
|
64
|
-
raise 'RSScreator: title
|
67
|
+
if @title.nil? or @description.nil? then
|
68
|
+
raise 'RSScreator: title or description can\'t be blank'
|
65
69
|
end
|
66
70
|
|
67
|
-
@dx.title, @dx.description = @title, @description
|
71
|
+
@dx.title, @dx.description, @dx.link = @title, @description, @link || ''
|
68
72
|
@dx.to_rss({limit: @limit})
|
69
73
|
|
70
74
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|