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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83b982dd220c9a0c0d6c1496c10cab8adf56693e
4
- data.tar.gz: 80d3de3242fd3dca6db4b86ef43c1efc3244d259
3
+ metadata.gz: 1c55bbb375aff51662e10d1254184218dede57bf
4
+ data.tar.gz: d646cecb9d7ce17567b596f27a22ebb653ab982c
5
5
  SHA512:
6
- metadata.gz: 5b169413ad7227c14cc7bcadbe1b480579a612364f220f3c1fbf38bbb67e77bf0c3781642ca34969c923c937438f8d3c2ea2ab83a89294736e9cc81e2edc712a
7
- data.tar.gz: e4d9d6f236c06fa2453a384f3f062a3cfc8b7645474b8f6a00add63eac1c235950ae51f0e6cd131c0109030500e247cd64d01e851e2140b41d652508c042366a
6
+ metadata.gz: 51df9b21a6631b9743afa2cba300eac7099061980d1806ee98488043169197fa94fddb1d033f1b801fd85d37248131f28649c986d36a13a1f482b62f38d07a6a
7
+ data.tar.gz: 3b021bdecd968143e95ea573c730b79d7a4baf254c1da54037ce0d635c51b55d92f54b427ee2b6ce73a3616667e69bf9d136621e05d336530380d845321429cf
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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]/item(title, link, description, created_at)'
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
- + 'item(title:title,description:description,link:link,pubDate:created_at)'
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
- record = {created_at: Time.now.strftime("%a, %d %b %Y %H:%M:%S %z")}.\
41
- merge(item)
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? then
64
- raise 'RSScreator: title, or description can\'t be blank'
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rss_creator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file