feedparser 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +36 -7
  3. data/README.md +145 -10
  4. data/Rakefile +1 -1
  5. data/lib/feedparser.rb +3 -0
  6. data/lib/feedparser/author.rb +39 -0
  7. data/lib/feedparser/builder/atom.rb +64 -17
  8. data/lib/feedparser/builder/json.rb +46 -10
  9. data/lib/feedparser/builder/rss.rb +94 -15
  10. data/lib/feedparser/feed.rb +30 -6
  11. data/lib/feedparser/generator.rb +34 -0
  12. data/lib/feedparser/item.rb +31 -6
  13. data/lib/feedparser/tag.rb +23 -0
  14. data/lib/feedparser/version.rb +2 -2
  15. data/test/feeds/books/nostarch.rss +125 -0
  16. data/test/feeds/books/oreilly.feedburner.atom +387 -0
  17. data/test/feeds/books/pragprog.rss +148 -0
  18. data/test/feeds/byparker.json +4 -4
  19. data/test/feeds/daringfireball.atom +8 -1
  20. data/test/feeds/daringfireball.json +28 -0
  21. data/test/feeds/googlegroups.atom +2 -2
  22. data/test/feeds/googlegroups2.atom +1 -1
  23. data/test/feeds/headius.atom +6 -5
  24. data/test/feeds/inessential.json +13 -4
  25. data/test/feeds/jsonfeed.json +8 -3
  26. data/test/feeds/{lambdatheultimate.rss2 → lambdatheultimate.rss} +0 -0
  27. data/test/feeds/{learnenough.atom → learnenough.feedburner.atom} +12 -9
  28. data/test/feeds/news/nytimes-blogs-bits.rss +333 -0
  29. data/test/feeds/news/nytimes-paul-krugman.rss +60 -0
  30. data/test/feeds/news/nytimes-tech.rss +653 -0
  31. data/test/feeds/news/nytimes-thomas-l-friedman.rss +80 -0
  32. data/test/feeds/news/nytimes.rss +607 -0
  33. data/test/feeds/news/washingtonpost-blogs-innovations.rss +183 -0
  34. data/test/feeds/news/washingtonpost-politics.rss +35 -0
  35. data/test/feeds/news/washingtonpost-world.rss +29 -0
  36. data/test/feeds/ongoing.atom +1619 -0
  37. data/test/feeds/osm/blog.openstreetmap.rss +252 -0
  38. data/test/feeds/osm/blogs.openstreetmap.rss +585 -0
  39. data/test/feeds/osm/mapbox.rss +1883 -0
  40. data/test/feeds/{railstutorial.atom → railstutorial.feedburner.atom} +28 -27
  41. data/test/feeds/{rubyflow.rss2 → rubyflow.feedburner.rss} +7 -3
  42. data/test/feeds/{rubymine.rss2 → rubymine.feedburner.rss} +5 -6
  43. data/test/feeds/scripting.rss +881 -0
  44. data/test/feeds/{sitepoint.rss2 → sitepoint.rss} +8 -9
  45. data/test/feeds/spec/atom/author.atom +48 -0
  46. data/test/feeds/spec/atom/authors.atom +70 -0
  47. data/test/feeds/spec/atom/categories.atom +66 -0
  48. data/test/feeds/spec/json/microblog.json +11 -2
  49. data/test/feeds/spec/json/tags.json +33 -0
  50. data/test/feeds/spec/rss/author.rss +41 -0
  51. data/test/feeds/spec/rss/categories.rss +64 -0
  52. data/test/feeds/spec/rss/creator.rss +38 -0
  53. data/test/feeds/{xkcd.rss2 → xkcd.rss} +0 -0
  54. data/test/helper.rb +21 -16
  55. data/test/test_atom.rb +1 -1
  56. data/test/test_atom_live.rb +1 -1
  57. data/test/test_authors.rb +26 -0
  58. data/test/test_books.rb +25 -0
  59. data/test/test_feeds.rb +4 -2
  60. data/test/test_rss.rb +4 -4
  61. data/test/test_tags.rb +25 -0
  62. metadata +39 -10
@@ -1,12 +1,12 @@
1
- <?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rss version="2.0"
2
3
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
3
4
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
4
5
  xmlns:dc="http://purl.org/dc/elements/1.1/"
5
6
  xmlns:atom="http://www.w3.org/2005/Atom"
6
7
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
7
8
  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
8
- xmlns:series="http://organizeseries.com/"
9
- >
9
+ xmlns:series="http://organizeseries.com/">
10
10
 
11
11
  <channel>
12
12
  <title>SitePoint &#187; Ruby</title>
@@ -207,13 +207,12 @@ Content Delivery Network via Amazon Web Services: CloudFront: dab1nmslvvntp.clou
207
207
 
208
208
  ---
209
209
 
210
- feed.format: rss 2.0
211
- feed.title: SitePoint » Ruby
212
- feed.url: http://www.sitepoint.com
213
- feed.summary: Learn CSS | HTML5 | JavaScript | Wordpress | Tutorials-Web Development | Reference | Books and More
214
- feed.generator: http://wordpress.org/?v=4.0
210
+ feed.format: rss 2.0
211
+ feed.title: SitePoint » Ruby
212
+ feed.url: http://www.sitepoint.com
213
+ feed.summary: Learn CSS | HTML5 | JavaScript | Wordpress | Tutorials-Web Development | Reference | Books and More
214
+ feed.generator.text: http://wordpress.org/?v=4.0
215
215
 
216
216
  feed.items[0].title: Rails Model Caching with Redis
217
217
  feed.items[0].url: http://www.sitepoint.com/rails-model-caching-redis/
218
218
  feed.items[0].guid: http://www.sitepoint.com/?p=97720
219
-
@@ -0,0 +1,48 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <title>Test Author</title>
4
+ <link rel="alternate" type="text/html" href="http://example.com/" />
5
+ <link rel="self" type="application/atom+xml" href="http://example.com/feed.xml" />
6
+ <id>http://example.com</id>
7
+ <updated>2017-05-23T19:36:44Z</updated>
8
+ <author>
9
+ <name>John Jay Gruber</name>
10
+ <uri>http://example.com/</uri>
11
+ </author>
12
+
13
+ <entry>
14
+ <title>Feedbin, Too</title>
15
+ <link rel="alternate" type="text/html" href="https://feedbin.com/blog/2017/05/22/feedbin-supports-json-feed/" />
16
+ <id>tag:daringfireball.net,2017:/linked//6.33732</id>
17
+ <published>2017-05-23T18:50:36Z</published>
18
+ <updated>2017-05-23T19:03:33Z</updated>
19
+ <author>
20
+ <name>Max Gruber Jun.</name>
21
+ <uri>http://example.com/</uri>
22
+ </author>
23
+ <content type="text">
24
+ Ben Ubois, announcing support for JSON Feed in Feedbin...
25
+ </content>
26
+ </entry>
27
+ </feed>
28
+
29
+ ---
30
+
31
+ feed.authors.size: >>> 1
32
+ feed.authors[0].name: John Jay Gruber
33
+ feed.authors[0].url: http://example.com/
34
+ feed.authors[0].email: >>> nil
35
+
36
+ feed.author.name: John Jay Gruber
37
+ feed.author.url: http://example.com/
38
+ feed.author.email: >>> nil
39
+
40
+
41
+ feed.items[0].authors.size: >>> 1
42
+ feed.items[0].authors[0].name: Max Gruber Jun.
43
+ feed.items[0].authors[0].url: http://example.com/
44
+ feed.items[0].authors[0].email: >>> nil
45
+
46
+ feed.items[0].author.name: Max Gruber Jun.
47
+ feed.items[0].author.url: http://example.com/
48
+ feed.items[0].author.email: >>> nil
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <feed xmlns="http://www.w3.org/2005/Atom">
3
+ <title>Test Author</title>
4
+ <link rel="alternate" type="text/html" href="http://example.com/" />
5
+ <link rel="self" type="application/atom+xml" href="http://example.com/feed.xml" />
6
+ <id>http://example.com</id>
7
+ <updated>2017-05-23T19:36:44Z</updated>
8
+ <author>
9
+ <name>John Jay Gruber</name>
10
+ <uri>http://example.com/</uri>
11
+ </author>
12
+ <author>
13
+ <name>Frank Huber</name>
14
+ <uri>http://example.com/frank/</uri>
15
+ </author>
16
+
17
+ <entry>
18
+ <title>Feedbin, Too</title>
19
+ <link rel="alternate" type="text/html" href="https://feedbin.com/blog/2017/05/22/feedbin-supports-json-feed/" />
20
+ <id>tag:daringfireball.net,2017:/linked//6.33732</id>
21
+ <published>2017-05-23T18:50:36Z</published>
22
+ <updated>2017-05-23T19:03:33Z</updated>
23
+ <author>
24
+ <name>Max Gruber Jun.</name>
25
+ <uri>http://example.com/</uri>
26
+ </author>
27
+ <author>
28
+ <name>Frank Huber</name>
29
+ <uri>http://example.com/frank/</uri>
30
+ <email>frank@example.com</email>
31
+ </author>
32
+ <author>
33
+ <name>George Imker</name>
34
+ <uri>http://example.com/george/</uri>
35
+ </author>
36
+ <content type="text">
37
+ Ben Ubois, announcing support for JSON Feed in Feedbin...
38
+ </content>
39
+ </entry>
40
+ </feed>
41
+
42
+ ---
43
+
44
+ feed.authors.size: >>> 2
45
+ feed.authors[0].name: John Jay Gruber
46
+ feed.authors[0].url: http://example.com/
47
+ feed.authors[0].email: >>> nil
48
+ feed.authors[1].name: Frank Huber
49
+ feed.authors[1].url: http://example.com/frank/
50
+
51
+ feed.author.name: John Jay Gruber
52
+ feed.author.url: http://example.com/
53
+ feed.author.email: >>> nil
54
+
55
+
56
+
57
+ feed.items[0].authors.size: >>> 3
58
+ feed.items[0].authors[0].name: Max Gruber Jun.
59
+ feed.items[0].authors[0].url: http://example.com/
60
+ feed.items[0].authors[0].email: >>> nil
61
+ feed.items[0].authors[1].name: Frank Huber
62
+ feed.items[0].authors[1].url: http://example.com/frank/
63
+ feed.items[0].authors[1].email: frank@example.com
64
+ feed.items[0].authors[2].name: George Imker
65
+ feed.items[0].authors[2].url: http://example.com/george/
66
+ feed.items[0].authors[2].email: >>> nil
67
+
68
+ feed.items[0].author.name: Max Gruber Jun.
69
+ feed.items[0].author.url: http://example.com/
70
+ feed.items[0].author.email: >>> nil
@@ -0,0 +1,66 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <feed xmlns='http://www.w3.org/2005/Atom'>
3
+ <title>Test Categories</title>
4
+ <link rel="alternate" type="text/html" href="http://example.com/" />
5
+ <link rel="self" type="application/atom+xml" href="http://example.com/feed.xml" />
6
+ <id>http://example.com</id>
7
+ <updated>2017-05-23T19:36:44Z</updated>
8
+
9
+ <category term="jruby"/>
10
+ <category term="ruby"/>
11
+ <category term="java"/>
12
+ <category term="rails"/>
13
+ <category term="invokedynamic"/>
14
+ <category term="jvm"/>
15
+ <category term="application bundle"/>
16
+ <category term="compilation"/>
17
+ <category term="compiler"/>
18
+ <category term="dynamic dispatch"/>
19
+ <category term="dynamic languages"/>
20
+ <category term="ruby 2.0"/>
21
+
22
+ <entry>
23
+
24
+ <title>Rock Surprise</title>
25
+ <link href='https://www.tbray.org/ongoing/When/201x/2017/05/20/Rock-Surprise' />
26
+ <id>https://www.tbray.org/ongoing/When/201x/2017/05/20/Rock-Surprise</id>
27
+ <published>2017-05-20T12:00:00-07:00</published>
28
+ <updated>2017-05-21T11:13:00-07:00</updated>
29
+
30
+ <category scheme='https://www.tbray.org/ongoing/What/' term='Arts/Music' />
31
+ <category scheme='https://www.tbray.org/ongoing/What/' term='Arts' />
32
+ <category scheme='https://www.tbray.org/ongoing/What/' term='Music' />
33
+ <category scheme='https://www.tbray.org/ongoing/What/' term='Arts/Photos' />
34
+ <category scheme='https://www.tbray.org/ongoing/What/' term='Photos' />
35
+
36
+ <content type="text">
37
+ On a recent Saturday we accidentally took in two very
38
+ different pop-music concerts...
39
+ </content>
40
+ </entry>
41
+ </feed>
42
+
43
+ ---
44
+
45
+ feed.tags.size: >>> 12
46
+ feed.tags[0].name: jruby
47
+ feed.tags[1].name: ruby
48
+ feed.tags[2].name: java
49
+ feed.tags[3].name: rails
50
+ feed.tags[4].name: invokedynamic
51
+ feed.tags[5].name: jvm
52
+ feed.tags[6].name: application bundle
53
+ feed.tags[7].name: compilation
54
+ feed.tags[8].name: compiler
55
+ feed.tags[9].name: dynamic dispatch
56
+ feed.tags[10].name: dynamic languages
57
+ feed.tags[11].name: ruby 2.0
58
+
59
+
60
+ feed.items[0].tags.size: >>> 5
61
+ feed.items[0].tags[0].name: Arts/Music
62
+ feed.items[0].tags[0].scheme: https://www.tbray.org/ongoing/What/
63
+ feed.items[0].tags[1].name: Arts
64
+ feed.items[0].tags[2].name: Music
65
+ feed.items[0].tags[3].name: Arts/Photos
66
+ feed.items[0].tags[4].name: Photos
@@ -26,9 +26,18 @@ feed.title: Brent Simmons’s Microblog
26
26
  feed.url: https://example.org/
27
27
  feed.feed_url: https://example.org/feed.json
28
28
 
29
- feed.items.size: >>> 1
29
+ feed.authors.size: >>> 1
30
+ feed.authors[0].name: Brent Simmons
31
+ feed.authors[0].url: http://example.org/
32
+ feed.authors[0].avatar: https://example.org/avatar.png
30
33
 
34
+
35
+ feed.items.size: >>> 1
31
36
  feed.items[0].id: 2347259
32
37
  feed.items[0].url: https://example.org/2347259
33
38
  feed.items[0].content_text: Cats are neat. \n\nhttps://example.org/cats
34
- feed.items[0].published: >>> DateTime.new( 2016, 2, 9, 14, 22, 0, '-7')
39
+ feed.items[0].published: >>> DateTime.new( 2016, 2, 9, 14, 22, 0, '-7').utc
40
+ feed.items[0].published_local: >>> DateTime.new( 2016, 2, 9, 14, 22, 0, '-7')
41
+
42
+ >>> pp feed.items[0].published
43
+ >>> pp feed.items[0].published_local
@@ -0,0 +1,33 @@
1
+ {
2
+ "version": "https://jsonfeed.org/version/1",
3
+ "title": "My Example Feed",
4
+ "home_page_url": "https://example.org/",
5
+ "feed_url": "https://example.org/feed.json",
6
+ "items": [
7
+ {
8
+ "id": "2",
9
+ "content_text": "This is a second item.",
10
+ "url": "https://example.org/second-item",
11
+ "tags": ["one", "two", "fourty four"]
12
+ },
13
+ {
14
+ "id": "1",
15
+ "content_html": "<p>Hello, world!</p>",
16
+ "url": "https://example.org/initial-post",
17
+ "tags": ["compiler","dynamic dispatch","dynamic languages","ruby 2.0"]
18
+ }
19
+ ]
20
+ }
21
+
22
+ ---
23
+
24
+ feed.items[0].tags.size: >>> 3
25
+ feed.items[0].tags[0].name: one
26
+ feed.items[0].tags[1].name: two
27
+ feed.items[0].tags[2].name: fourty four
28
+
29
+ feed.items[1].tags.size: >>> 4
30
+ feed.items[1].tags[0].name: compiler
31
+ feed.items[1].tags[1].name: dynamic dispatch
32
+ feed.items[1].tags[2].name: dynamic languages
33
+ feed.items[1].tags[3].name: ruby 2.0
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0"?>
2
+ <rss version="2.0">
3
+ <channel>
4
+ <title>Test Author</title>
5
+ <link>http://example.com/</link>
6
+ <description/>
7
+ <lastBuildDate>Mon, 29 May 2017 18:51:30 GMT </lastBuildDate>
8
+ <managingEditor>Matt Flegenheimer Jr.</managingEditor>
9
+ <webMaster>Matt Flegenheimer Sr.</webMaster>
10
+ <item>
11
+ <title>Jared Kushner&#x2019;s Role Is Tested as Russia Case Grows</title>
12
+ <link>https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html?partner=rss&amp;emc=rss</link>
13
+ <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html</guid>
14
+ <pubDate>Mon, 29 May 2017 01:23:57 GMT</pubDate>
15
+ <author>Peter Baker</author>
16
+ </item>
17
+ </channel>
18
+ </rss>
19
+
20
+ ---
21
+
22
+ feed.authors.size: >>> 2
23
+ feed.authors[0].text: Matt Flegenheimer Jr.
24
+ feed.authors[0].to_s: Matt Flegenheimer Jr.
25
+ feed.authors[0].email: >>> nil
26
+ feed.authors[1].text: Matt Flegenheimer Sr.
27
+ feed.authors[1].to_s: Matt Flegenheimer Sr.
28
+
29
+ feed.author.text: Matt Flegenheimer Jr.
30
+ feed.author.to_s: Matt Flegenheimer Jr.
31
+ feed.author.email: >>> nil
32
+
33
+
34
+ feed.items[0].authors.size: >>> 1
35
+ feed.items[0].authors[0].text: Peter Baker
36
+ feed.items[0].authors[0].to_s: Peter Baker
37
+ feed.items[0].authors[0].email: >>> nil
38
+
39
+ feed.items[0].author.text: Peter Baker
40
+ feed.items[0].author.to_s: Peter Baker
41
+ feed.items[0].author.email: >>> nil
@@ -0,0 +1,64 @@
1
+ <?xml version="1.0"?>
2
+ <rss version="2.0">
3
+ <channel>
4
+ <title>Test Categories</title>
5
+ <link>http://example.com</link>
6
+ <description/>
7
+ <lastBuildDate>Mon, 29 May 2017 18:51:30 GMT </lastBuildDate>
8
+ <category domain="http://www.nytimes.com/namespaces/keywords/des">United States Politics and Government</category>
9
+ <category domain="http://www.nytimes.com/namespaces/keywords/des">Social Media</category>
10
+ <category domain="http://www.nytimes.com/namespaces/keywords/mdes">News and News Media</category>
11
+
12
+ <item>
13
+ <title>Jared Kushner&#x2019;s Role Is Tested as Russia Case Grows</title>
14
+ <link>https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html?partner=rss&amp;emc=rss</link>
15
+ <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html</guid>
16
+ <description>It is unclear how Jared Kushner&#x2019;s high-profile woes will affect his hard-won partnership with his father-in-law, perhaps the most stable in an often unstable White House.</description>
17
+ <pubDate>Mon, 29 May 2017 01:23:57 GMT</pubDate>
18
+ <category domain="http://www.nytimes.com/namespaces/keywords/mdes">Presidents and Presidency (US)</category>
19
+ <category domain="http://www.nytimes.com/namespaces/keywords/des">Appointments and Executive Changes</category>
20
+ <category domain="http://www.nytimes.com/namespaces/keywords/nyt_geo">United States</category>
21
+ <category domain="http://www.nytimes.com/namespaces/keywords/nyt_per">Jared Kushner</category>
22
+ <category domain="http://www.nytimes.com/namespaces/keywords/nyt_per">Donald J. Trump</category>
23
+ </item>
24
+
25
+ <item>
26
+ <title>Reported Talks by Jared Kushner With Russia Would Be &#x2018;Good Thing,&#x2019; Trump Official Says</title>
27
+ <link>https://www.nytimes.com/2017/05/28/us/politics/trump-returns-to-us-and-to-berating-newsmedia-on-twitter.html?partner=rss&amp;emc=rss</link>
28
+ <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/politics/trump-returns-to-us-and-to-berating-newsmedia-on-twitter.html</guid>
29
+ <description>John F. Kelly, the homeland security secretary, played down reports of a back channel. The president, meanwhile, resumed using Twitter as a weapon.</description>
30
+ <pubDate>Sun, 28 May 2017 16:57:05 GMT</pubDate>
31
+ <category domain="http://www.nytimes.com/namespaces/keywords/nyt_per">Trump, Donald J</category>
32
+ <category domain="http://www.nytimes.com/namespaces/keywords/des">United States Politics and Government</category>
33
+ <category domain="http://www.nytimes.com/namespaces/keywords/des">Social Media</category>
34
+ <category domain="http://www.nytimes.com/namespaces/keywords/mdes">News and News Media</category>
35
+ <category domain="http://www.nytimes.com/namespaces/keywords/nyt_org_all">Twitter</category>
36
+ </item>
37
+ </channel>
38
+ </rss>
39
+
40
+ ---
41
+
42
+ feed.tags.size: >>> 3
43
+ feed.tags[0].name: United States Politics and Government
44
+ feed.tags[0].domain: http://www.nytimes.com/namespaces/keywords/des
45
+ feed.tags[1].name: Social Media
46
+ feed.tags[2].name: News and News Media
47
+
48
+
49
+ feed.items[0].tags.size: >>> 5
50
+ feed.items[0].tags[0].name: Presidents and Presidency (US)
51
+ feed.items[0].tags[0].domain: http://www.nytimes.com/namespaces/keywords/mdes
52
+ feed.items[0].tags[1].name: Appointments and Executive Changes
53
+ feed.items[0].tags[2].name: United States
54
+ feed.items[0].tags[3].name: Jared Kushner
55
+ feed.items[0].tags[4].name: Donald J. Trump
56
+
57
+
58
+ feed.items[1].tags.size: >>> 5
59
+ feed.items[1].tags[0].name: Trump, Donald J
60
+ feed.items[1].tags[0].domain: http://www.nytimes.com/namespaces/keywords/nyt_per
61
+ feed.items[1].tags[1].name: United States Politics and Government
62
+ feed.items[1].tags[2].name: Social Media
63
+ feed.items[1].tags[3].name: News and News Media
64
+ feed.items[1].tags[4].name: Twitter
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0"?>
2
+ <rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
3
+ <channel>
4
+ <title>Test Dublin Core</title>
5
+ <link>http://example.com/</link>
6
+ <description/>
7
+ <lastBuildDate>Mon, 29 May 2017 18:51:30 GMT </lastBuildDate>
8
+ <dc:creator>Matt Flegenheimer</dc:creator>
9
+ <item>
10
+ <title>Jared Kushner&#x2019;s Role Is Tested as Russia Case Grows</title>
11
+ <link>https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html?partner=rss&amp;emc=rss</link>
12
+ <guid isPermaLink="true">https://www.nytimes.com/2017/05/28/us/kushner-trump-relationship-russia-investigation.html</guid>
13
+ <pubDate>Mon, 29 May 2017 01:23:57 GMT</pubDate>
14
+ <dc:creator>Peter Baker</dc:creator>
15
+ </item>
16
+ </channel>
17
+ </rss>
18
+
19
+ ---
20
+
21
+ feed.authors.size: >>> 1
22
+ feed.authors[0].text: Matt Flegenheimer
23
+ feed.authors[0].to_s: Matt Flegenheimer
24
+ feed.authors[0].email: >>> nil
25
+
26
+ feed.author.text: Matt Flegenheimer
27
+ feed.author.to_s: Matt Flegenheimer
28
+ feed.author.email: >>> nil
29
+
30
+
31
+ feed.items[0].authors.size: >>> 1
32
+ feed.items[0].authors[0].text: Peter Baker
33
+ feed.items[0].authors[0].to_s: Peter Baker
34
+ feed.items[0].authors[0].email: >>> nil
35
+
36
+ feed.items[0].author.text: Peter Baker
37
+ feed.items[0].author.to_s: Peter Baker
38
+ feed.items[0].author.email: >>> nil
File without changes
@@ -39,22 +39,27 @@ class Test
39
39
 
40
40
  line = line.strip
41
41
 
42
- pos = line.index(':') ## assume first colon (:) is separator
43
- expr = line[0...pos].strip ## NOTE: do NOT include colon (thus, use tree dots ...)
44
- value = line[pos+1..-1].strip
45
-
46
-
47
- ## for ruby code use |> or >> or >>> or => or $ or | or RUN or ????
48
- ## otherwise assume "literal" string
49
-
50
- if value.start_with? '>>>'
51
- value = value[3..-1].strip
52
- code="assert_equal #{value}, #{expr}"
53
- elsif value.start_with? 'DateTime' ## todo/fix: remove; use >>> style
54
- code="assert_equal #{value}, #{expr}"
55
- else # assume value is a "plain" string
56
- ## note use %{ } so value can include quotes ('') etc.
57
- code="assert_equal %{#{value}}, #{expr}"
42
+
43
+ if line.start_with? '>>>'
44
+ ## for debugging allow "custom" code e.g. >>> pp feed.items[0].summary etc.
45
+ code = line[3..-1].strip
46
+ else
47
+ pos = line.index(':') ## assume first colon (:) is separator
48
+ expr = line[0...pos].strip ## NOTE: do NOT include colon (thus, use tree dots ...)
49
+ value = line[pos+1..-1].strip
50
+
51
+ ## for ruby code use |> or >> or >>> or => or $ or | or RUN or ????
52
+ ## otherwise assume "literal" string
53
+
54
+ if value.start_with? '>>>'
55
+ value = value[3..-1].strip
56
+ code="assert_equal #{value}, #{expr}"
57
+ elsif value.start_with? 'DateTime' ## todo/fix: remove; use >>> style
58
+ code="assert_equal #{value}, #{expr}"
59
+ else # assume value is a "plain" string
60
+ ## note use %{ } so value can include quotes ('') etc.
61
+ code="assert_equal %{#{value}}, #{expr}"
62
+ end
58
63
  end
59
64
 
60
65
  puts "eval #{code}"