html2rss 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +18 -11
- data/.travis.yml +3 -3
- data/.yardopts +6 -0
- data/Gemfile.lock +23 -5
- data/README.md +2 -1
- data/docs/Html2rss.html +353 -0
- data/docs/Html2rss/AttributePostProcessors.html +203 -0
- data/docs/Html2rss/AttributePostProcessors/ParseTime.html +332 -0
- data/docs/Html2rss/AttributePostProcessors/ParseUri.html +314 -0
- data/docs/Html2rss/AttributePostProcessors/SanitizeHtml.html +346 -0
- data/docs/Html2rss/AttributePostProcessors/Substring.html +321 -0
- data/docs/Html2rss/AttributePostProcessors/Template.html +336 -0
- data/docs/Html2rss/Config.html +795 -0
- data/docs/Html2rss/FeedBuilder.html +295 -0
- data/docs/Html2rss/Item.html +654 -0
- data/docs/Html2rss/ItemExtractors.html +297 -0
- data/docs/Html2rss/ItemExtractors/Attribute.html +317 -0
- data/docs/Html2rss/ItemExtractors/CurrentTime.html +297 -0
- data/docs/Html2rss/ItemExtractors/Href.html +319 -0
- data/docs/Html2rss/ItemExtractors/Html.html +314 -0
- data/docs/Html2rss/ItemExtractors/Static.html +301 -0
- data/docs/Html2rss/ItemExtractors/Text.html +312 -0
- data/docs/Html2rss/Utils.html +115 -0
- data/docs/Html2rss/Utils/IndifferentAccessHash.html +142 -0
- data/docs/_index.html +300 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +135 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +135 -0
- data/docs/js/app.js +303 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +435 -0
- data/docs/top-level-namespace.html +110 -0
- data/html2rss.gemspec +3 -0
- data/lib/html2rss.rb +19 -4
- data/lib/html2rss/attribute_post_processors.rb +5 -3
- data/lib/html2rss/attribute_post_processors/parse_time.rb +29 -3
- data/lib/html2rss/attribute_post_processors/parse_uri.rb +20 -1
- data/lib/html2rss/attribute_post_processors/sanitize_html.rb +65 -3
- data/lib/html2rss/attribute_post_processors/substring.rb +24 -3
- data/lib/html2rss/attribute_post_processors/template.rb +37 -10
- data/lib/html2rss/config.rb +11 -12
- data/lib/html2rss/feed_builder.rb +8 -6
- data/lib/html2rss/item.rb +28 -19
- data/lib/html2rss/item_extractors.rb +29 -0
- data/lib/html2rss/item_extractors/attribute.rb +37 -0
- data/lib/html2rss/item_extractors/current_time.rb +21 -0
- data/lib/html2rss/item_extractors/href.rb +36 -0
- data/lib/html2rss/item_extractors/html.rb +34 -0
- data/lib/html2rss/item_extractors/static.rb +28 -0
- data/lib/html2rss/item_extractors/text.rb +32 -0
- data/lib/html2rss/utils.rb +25 -0
- data/lib/html2rss/version.rb +1 -1
- metadata +88 -4
- data/lib/html2rss/item_extractor.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8cc23b576bb2c4524a79eba0205042193210e9a44740788622ea2c4bd8b4b6
|
4
|
+
data.tar.gz: ee9d0c8bc4894a5961544d913a914790eab7081e9a6f473e0d0dd036260273d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09c84e2c7c0182808750836990373e9b150aa6dcef6ba8570017ee9d4d0e0d883a7f78820a28a3f89673ac0bf9224870a12dfa2a270eabdc2af25e58d5a6bb70'
|
7
|
+
data.tar.gz: 1a1e7ec59567b19c1f5e528f37bf2f90f7a362bf5f55f9757b73498b26b2af500a6c37c2a472fb330184c0438e4597b12fbb9e04e86d983dbbeecf57a73925ed
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require:
|
2
|
-
-
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
3
4
|
|
4
5
|
AllCops:
|
5
6
|
TargetRubyVersion: 2.4
|
@@ -21,14 +22,13 @@ Documentation:
|
|
21
22
|
Enabled: false
|
22
23
|
|
23
24
|
Style/BlockDelimiters:
|
24
|
-
Enabled:
|
25
|
+
Enabled: true
|
26
|
+
Exclude:
|
27
|
+
- '**/*_spec.rb'
|
25
28
|
|
26
29
|
Style/FrozenStringLiteralComment:
|
27
30
|
Enabled: false
|
28
31
|
|
29
|
-
Style/ParallelAssignment:
|
30
|
-
Enabled: false
|
31
|
-
|
32
32
|
Style/AsciiComments:
|
33
33
|
Enabled: false
|
34
34
|
|
@@ -37,13 +37,20 @@ Style/BracesAroundHashParameters:
|
|
37
37
|
Enabled: true
|
38
38
|
|
39
39
|
Style/HashSyntax:
|
40
|
-
Description: >-
|
41
|
-
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
42
|
-
{ :a => 1, :b => 2 }.
|
43
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
|
44
40
|
Enabled: true
|
45
41
|
|
46
42
|
Layout/SpaceInsideParens:
|
47
|
-
Description: 'No spaces after ( or before ).'
|
48
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
49
43
|
Enabled: true
|
44
|
+
|
45
|
+
Performance/CaseWhenSplat:
|
46
|
+
Enabled: true
|
47
|
+
|
48
|
+
Performance/ChainArrayAllocation:
|
49
|
+
Enabled: true
|
50
|
+
|
51
|
+
Performance/OpenStruct:
|
52
|
+
Enabled: true
|
53
|
+
|
54
|
+
RSpec/NestedGroups:
|
55
|
+
Exclude:
|
56
|
+
- spec/html2rss_spec.rb
|
data/.travis.yml
CHANGED
data/.yardopts
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
html2rss (0.
|
4
|
+
html2rss (0.4.0)
|
5
|
+
activesupport (~> 5.0)
|
5
6
|
faraday (~> 0.15)
|
6
7
|
faraday_middleware (~> 0.13)
|
7
8
|
hashie (~> 3.6)
|
@@ -11,8 +12,14 @@ PATH
|
|
11
12
|
GEM
|
12
13
|
remote: https://rubygems.org/
|
13
14
|
specs:
|
15
|
+
activesupport (5.2.3)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 0.7, < 2)
|
18
|
+
minitest (~> 5.1)
|
19
|
+
tzinfo (~> 1.1)
|
14
20
|
ast (2.4.0)
|
15
21
|
byebug (11.0.1)
|
22
|
+
concurrent-ruby (1.1.5)
|
16
23
|
crass (1.0.4)
|
17
24
|
diff-lcs (1.3)
|
18
25
|
docile (1.3.2)
|
@@ -21,11 +28,14 @@ GEM
|
|
21
28
|
faraday_middleware (0.13.1)
|
22
29
|
faraday (>= 0.7.4, < 1.0)
|
23
30
|
hashie (3.6.0)
|
31
|
+
i18n (1.6.0)
|
32
|
+
concurrent-ruby (~> 1.0)
|
24
33
|
jaro_winkler (1.5.3)
|
25
34
|
json (2.2.0)
|
26
35
|
mini_portile2 (2.4.0)
|
36
|
+
minitest (5.11.3)
|
27
37
|
multipart-post (2.1.1)
|
28
|
-
nokogiri (1.10.
|
38
|
+
nokogiri (1.10.4)
|
29
39
|
mini_portile2 (~> 2.4.0)
|
30
40
|
nokogumbo (2.0.1)
|
31
41
|
nokogiri (~> 1.8, >= 1.8.4)
|
@@ -37,7 +47,7 @@ GEM
|
|
37
47
|
rspec-core (~> 3.8.0)
|
38
48
|
rspec-expectations (~> 3.8.0)
|
39
49
|
rspec-mocks (~> 3.8.0)
|
40
|
-
rspec-core (3.8.
|
50
|
+
rspec-core (3.8.2)
|
41
51
|
rspec-support (~> 3.8.0)
|
42
52
|
rspec-expectations (3.8.4)
|
43
53
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -46,7 +56,7 @@ GEM
|
|
46
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
47
57
|
rspec-support (~> 3.8.0)
|
48
58
|
rspec-support (3.8.2)
|
49
|
-
rubocop (0.
|
59
|
+
rubocop (0.72.0)
|
50
60
|
jaro_winkler (~> 1.5.1)
|
51
61
|
parallel (~> 1.10)
|
52
62
|
parser (>= 2.6)
|
@@ -55,18 +65,24 @@ GEM
|
|
55
65
|
unicode-display_width (>= 1.4.0, < 1.7)
|
56
66
|
rubocop-performance (1.4.0)
|
57
67
|
rubocop (>= 0.71.0)
|
68
|
+
rubocop-rspec (1.34.1)
|
69
|
+
rubocop (>= 0.60.0)
|
58
70
|
ruby-progressbar (1.10.1)
|
59
71
|
sanitize (5.0.0)
|
60
72
|
crass (~> 1.0.2)
|
61
73
|
nokogiri (>= 1.8.0)
|
62
74
|
nokogumbo (~> 2.0)
|
63
|
-
simplecov (0.
|
75
|
+
simplecov (0.17.0)
|
64
76
|
docile (~> 1.1)
|
65
77
|
json (>= 1.8, < 3)
|
66
78
|
simplecov-html (~> 0.10.0)
|
67
79
|
simplecov-html (0.10.2)
|
80
|
+
thread_safe (0.3.6)
|
81
|
+
tzinfo (1.2.5)
|
82
|
+
thread_safe (~> 0.1)
|
68
83
|
unicode-display_width (1.6.0)
|
69
84
|
vcr (5.0.0)
|
85
|
+
yard (0.9.20)
|
70
86
|
|
71
87
|
PLATFORMS
|
72
88
|
ruby
|
@@ -78,8 +94,10 @@ DEPENDENCIES
|
|
78
94
|
rspec (~> 3.0)
|
79
95
|
rubocop
|
80
96
|
rubocop-performance
|
97
|
+
rubocop-rspec
|
81
98
|
simplecov
|
82
99
|
vcr
|
100
|
+
yard
|
83
101
|
|
84
102
|
BUNDLED WITH
|
85
103
|
1.17.2
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Request HTML from an URL and transform it to a Ruby RSS 2.0 object.
|
|
9
9
|
|
10
10
|
Each website needs a *feed config* which contains the URL to scrape and
|
11
11
|
CSS selectors to extract the required information (like title, URL, ...).
|
12
|
-
This gem provides [extractors](https://github.com/gildesmarais/html2rss/blob/master/lib/html2rss/
|
12
|
+
This gem provides [extractors](https://github.com/gildesmarais/html2rss/blob/master/lib/html2rss/item_extractors) (e.g. extract the information from an HTML attribute)
|
13
13
|
and chainable [post processors](https://github.com/gildesmarais/html2rss/tree/master/lib/html2rss/attribute_post_processors) to make information retrieval even easier.
|
14
14
|
|
15
15
|
## Installation
|
@@ -50,6 +50,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/gildes
|
|
50
50
|
|
51
51
|
## Releasing a new version
|
52
52
|
|
53
|
+
0. `git pull`
|
53
54
|
1. increase version in `lib/version.rb`
|
54
55
|
2. `bundle`
|
55
56
|
3. commit the changes
|
data/docs/Html2rss.html
ADDED
@@ -0,0 +1,353 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: Html2rss
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Html2rss";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (H)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Html2rss</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: Html2rss
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/html2rss.rb<span class="defines">,<br />
|
82
|
+
lib/html2rss/item.rb,<br /> lib/html2rss/utils.rb,<br /> lib/html2rss/config.rb,<br /> lib/html2rss/version.rb,<br /> lib/html2rss/feed_builder.rb,<br /> lib/html2rss/item_extractors.rb,<br /> lib/html2rss/item_extractors/href.rb,<br /> lib/html2rss/item_extractors/html.rb,<br /> lib/html2rss/item_extractors/text.rb,<br /> lib/html2rss/item_extractors/static.rb,<br /> lib/html2rss/attribute_post_processors.rb,<br /> lib/html2rss/item_extractors/attribute.rb,<br /> lib/html2rss/item_extractors/current_time.rb,<br /> lib/html2rss/attribute_post_processors/template.rb,<br /> lib/html2rss/attribute_post_processors/parse_uri.rb,<br /> lib/html2rss/attribute_post_processors/substring.rb,<br /> lib/html2rss/attribute_post_processors/parse_time.rb,<br /> lib/html2rss/attribute_post_processors/sanitize_html.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Defined Under Namespace</h2>
|
89
|
+
<p class="children">
|
90
|
+
|
91
|
+
|
92
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Html2rss/AttributePostProcessors.html" title="Html2rss::AttributePostProcessors (module)">AttributePostProcessors</a></span>, <span class='object_link'><a href="Html2rss/ItemExtractors.html" title="Html2rss::ItemExtractors (module)">ItemExtractors</a></span>, <span class='object_link'><a href="Html2rss/Utils.html" title="Html2rss::Utils (module)">Utils</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Html2rss/Config.html" title="Html2rss::Config (class)">Config</a></span>, <span class='object_link'><a href="Html2rss/FeedBuilder.html" title="Html2rss::FeedBuilder (class)">FeedBuilder</a></span>, <span class='object_link'><a href="Html2rss/Item.html" title="Html2rss::Item (class)">Item</a></span>
|
97
|
+
|
98
|
+
|
99
|
+
</p>
|
100
|
+
|
101
|
+
|
102
|
+
<h2>
|
103
|
+
Constant Summary
|
104
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
105
|
+
</h2>
|
106
|
+
|
107
|
+
<dl class="constants">
|
108
|
+
|
109
|
+
<dt id="VERSION-constant" class="">VERSION =
|
110
|
+
|
111
|
+
</dt>
|
112
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.3.3</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
113
|
+
|
114
|
+
</dl>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<h2>
|
125
|
+
Class Method Summary
|
126
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
127
|
+
</h2>
|
128
|
+
|
129
|
+
<ul class="summary">
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#feed-class_method" title="feed (class method)">.<strong>feed</strong>(config) ⇒ RSS:Rss </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<span class="summary_desc"><div class='inline'>
|
149
|
+
<p>Returns a RSS object which is generated from the provided config.</p>
|
150
|
+
</div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
<li class="public ">
|
156
|
+
<span class="summary_signature">
|
157
|
+
|
158
|
+
<a href="#feed_from_yaml_config-class_method" title="feed_from_yaml_config (class method)">.<strong>feed_from_yaml_config</strong>(file, name) ⇒ RSS:Rss </a>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'>
|
173
|
+
<p>Returns a RSS object which is generated from the provided file.</p>
|
174
|
+
</div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
</ul>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<div id="class_method_details" class="method_details_list">
|
185
|
+
<h2>Class Method Details</h2>
|
186
|
+
|
187
|
+
|
188
|
+
<div class="method_details first">
|
189
|
+
<h3 class="signature first" id="feed-class_method">
|
190
|
+
|
191
|
+
.<strong>feed</strong>(config) ⇒ <tt>RSS:Rss</tt>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
</h3><div class="docstring">
|
198
|
+
<div class="discussion">
|
199
|
+
|
200
|
+
<p>Returns a RSS object which is generated from the provided config.</p>
|
201
|
+
|
202
|
+
<p>`config`: can be a Hash or an instance of Html2rss::Config.</p>
|
203
|
+
|
204
|
+
<p>Example:</p>
|
205
|
+
|
206
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_feed'>feed</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Html2rss (module)">Html2rss</a></span></span><span class='period'>.</span><span class='id identifier rubyid_feed'>feed</span><span class='lparen'>(</span>
|
207
|
+
<span class='label'>channel:</span> <span class='lbrace'>{</span> <span class='label'>name:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>StackOverflow: Hot Network Questions</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>url:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https://stackoverflow.com</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
208
|
+
<span class='label'>selectors:</span> <span class='lbrace'>{</span>
|
209
|
+
<span class='label'>items:</span> <span class='lbrace'>{</span> <span class='label'>selector:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>#hot-network-questions > ul > li</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
210
|
+
<span class='label'>title:</span> <span class='lbrace'>{</span> <span class='label'>selector:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>a</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
211
|
+
<span class='label'>link:</span> <span class='lbrace'>{</span> <span class='label'>selector:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>a</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>extractor:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>href</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
|
212
|
+
<span class='rbrace'>}</span>
|
213
|
+
<span class='rparen'>)</span>
|
214
|
+
<span class='comment'># => #<RSS::Rss:0x00007fb2f48d14a0 ...>
|
215
|
+
</span></code></pre>
|
216
|
+
|
217
|
+
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
<div class="tags">
|
221
|
+
|
222
|
+
<p class="tag_title">Returns:</p>
|
223
|
+
<ul class="return">
|
224
|
+
|
225
|
+
<li>
|
226
|
+
|
227
|
+
|
228
|
+
<span class='type'>(<tt>RSS:Rss</tt>)</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</li>
|
233
|
+
|
234
|
+
</ul>
|
235
|
+
|
236
|
+
</div><table class="source_code">
|
237
|
+
<tr>
|
238
|
+
<td>
|
239
|
+
<pre class="lines">
|
240
|
+
|
241
|
+
|
242
|
+
48
|
243
|
+
49
|
244
|
+
50
|
245
|
+
51
|
246
|
+
52
|
247
|
+
53</pre>
|
248
|
+
</td>
|
249
|
+
<td>
|
250
|
+
<pre class="code"><span class="info file"># File 'lib/html2rss.rb', line 48</span>
|
251
|
+
|
252
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_feed'>feed</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
|
253
|
+
<span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Html2rss/Config.html" title="Html2rss::Config (class)">Config</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Html2rss/Config.html#initialize-instance_method" title="Html2rss::Config#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Html2rss/Config.html" title="Html2rss::Config (class)">Config</a></span></span><span class='rparen'>)</span>
|
254
|
+
|
255
|
+
<span class='id identifier rubyid_feed'>feed</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Html2rss/FeedBuilder.html" title="Html2rss::FeedBuilder (class)">FeedBuilder</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Html2rss/FeedBuilder.html#initialize-instance_method" title="Html2rss::FeedBuilder#initialize (method)">new</a></span></span> <span class='id identifier rubyid_config'>config</span>
|
256
|
+
<span class='id identifier rubyid_feed'>feed</span><span class='period'>.</span><span class='id identifier rubyid_rss'>rss</span>
|
257
|
+
<span class='kw'>end</span></pre>
|
258
|
+
</td>
|
259
|
+
</tr>
|
260
|
+
</table>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div class="method_details ">
|
264
|
+
<h3 class="signature " id="feed_from_yaml_config-class_method">
|
265
|
+
|
266
|
+
.<strong>feed_from_yaml_config</strong>(file, name) ⇒ <tt>RSS:Rss</tt>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
</h3><div class="docstring">
|
273
|
+
<div class="discussion">
|
274
|
+
|
275
|
+
<p>Returns a RSS object which is generated from the provided file.</p>
|
276
|
+
|
277
|
+
<p>`file_path`: a File object of a YAML file `name`: the of the feed</p>
|
278
|
+
|
279
|
+
<p>Example:</p>
|
280
|
+
|
281
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_feed'>feed</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="Html2rss (module)">Html2rss</a></span></span><span class='period'>.</span><span class='id identifier rubyid_feed_from_yaml_config'>feed_from_yaml_config</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>spec</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>config.test.yml</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nuxt-releases</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
282
|
+
<span class='comment'># => #<RSS::Rss:0x00007fb2f6331228
|
283
|
+
</span></code></pre>
|
284
|
+
|
285
|
+
|
286
|
+
</div>
|
287
|
+
</div>
|
288
|
+
<div class="tags">
|
289
|
+
|
290
|
+
<p class="tag_title">Returns:</p>
|
291
|
+
<ul class="return">
|
292
|
+
|
293
|
+
<li>
|
294
|
+
|
295
|
+
|
296
|
+
<span class='type'>(<tt>RSS:Rss</tt>)</span>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
</li>
|
301
|
+
|
302
|
+
</ul>
|
303
|
+
|
304
|
+
</div><table class="source_code">
|
305
|
+
<tr>
|
306
|
+
<td>
|
307
|
+
<pre class="lines">
|
308
|
+
|
309
|
+
|
310
|
+
19
|
311
|
+
20
|
312
|
+
21
|
313
|
+
22
|
314
|
+
23
|
315
|
+
24
|
316
|
+
25
|
317
|
+
26
|
318
|
+
27
|
319
|
+
28
|
320
|
+
29</pre>
|
321
|
+
</td>
|
322
|
+
<td>
|
323
|
+
<pre class="code"><span class="info file"># File 'lib/html2rss.rb', line 19</span>
|
324
|
+
|
325
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_feed_from_yaml_config'>feed_from_yaml_config</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
326
|
+
<span class='comment'># rubocop:disable Security/YAMLLoad
|
327
|
+
</span> <span class='id identifier rubyid_yaml'>yaml</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
328
|
+
<span class='comment'># rubocop:enable Security/YAMLLoad
|
329
|
+
</span>
|
330
|
+
<span class='id identifier rubyid_feed_config'>feed_config</span> <span class='op'>=</span> <span class='id identifier rubyid_yaml'>yaml</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>feeds</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span>
|
331
|
+
<span class='id identifier rubyid_global_config'>global_config</span> <span class='op'>=</span> <span class='id identifier rubyid_yaml'>yaml</span><span class='period'>.</span><span class='id identifier rubyid_reject'>reject</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>feeds</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
|
332
|
+
|
333
|
+
<span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Html2rss/Config.html" title="Html2rss::Config (class)">Config</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Html2rss/Config.html#initialize-instance_method" title="Html2rss::Config#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_feed_config'>feed_config</span><span class='comma'>,</span> <span class='id identifier rubyid_global_config'>global_config</span><span class='rparen'>)</span>
|
334
|
+
<span class='id identifier rubyid_feed'>feed</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
|
335
|
+
<span class='kw'>end</span></pre>
|
336
|
+
</td>
|
337
|
+
</tr>
|
338
|
+
</table>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
</div>
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
<div id="footer">
|
346
|
+
Generated on Sun Jul 14 19:35:05 2019 by
|
347
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
348
|
+
0.9.20 (ruby-2.6.3).
|
349
|
+
</div>
|
350
|
+
|
351
|
+
</div>
|
352
|
+
</body>
|
353
|
+
</html>
|