dh_easy-core 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +7 -0
- data/.yardopts +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +20 -0
- data/Rakefile +22 -0
- data/dh_easy-core.gemspec +50 -0
- data/doc/DhEasy.html +117 -0
- data/doc/DhEasy/Core.html +1590 -0
- data/doc/DhEasy/Core/Config.html +311 -0
- data/doc/DhEasy/Core/Exception.html +117 -0
- data/doc/DhEasy/Core/Exception/OutdatedError.html +135 -0
- data/doc/DhEasy/Core/Helper.html +117 -0
- data/doc/DhEasy/Core/Helper/Cookie.html +1070 -0
- data/doc/DhEasy/Core/Mock.html +282 -0
- data/doc/DhEasy/Core/Mock/FakeDb.html +3779 -0
- data/doc/DhEasy/Core/Mock/FakeExecutor.html +3289 -0
- data/doc/DhEasy/Core/Mock/FakeFinisher.html +160 -0
- data/doc/DhEasy/Core/Mock/FakeParser.html +160 -0
- data/doc/DhEasy/Core/Mock/FakeSeeder.html +160 -0
- data/doc/DhEasy/Core/Plugin.html +117 -0
- data/doc/DhEasy/Core/Plugin/CollectionVault.html +299 -0
- data/doc/DhEasy/Core/Plugin/ConfigBehavior.html +541 -0
- data/doc/DhEasy/Core/Plugin/ContextIntegrator.html +445 -0
- data/doc/DhEasy/Core/Plugin/Executor.html +259 -0
- data/doc/DhEasy/Core/Plugin/ExecutorBehavior.html +344 -0
- data/doc/DhEasy/Core/Plugin/Finisher.html +265 -0
- data/doc/DhEasy/Core/Plugin/FinisherBehavior.html +142 -0
- data/doc/DhEasy/Core/Plugin/InitializeHook.html +220 -0
- data/doc/DhEasy/Core/Plugin/Parser.html +270 -0
- data/doc/DhEasy/Core/Plugin/ParserBehavior.html +235 -0
- data/doc/DhEasy/Core/Plugin/Seeder.html +674 -0
- data/doc/DhEasy/Core/Plugin/SeederBehavior.html +142 -0
- data/doc/DhEasy/Core/SmartCollection.html +1087 -0
- data/doc/_index.html +364 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +91 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +91 -0
- data/doc/js/app.js +303 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +939 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/dh_easy/core.rb +257 -0
- data/lib/dh_easy/core/config.rb +27 -0
- data/lib/dh_easy/core/exception.rb +8 -0
- data/lib/dh_easy/core/exception/outdated_error.rb +9 -0
- data/lib/dh_easy/core/helper.rb +8 -0
- data/lib/dh_easy/core/helper/cookie.rb +209 -0
- data/lib/dh_easy/core/mock.rb +45 -0
- data/lib/dh_easy/core/mock/fake_db.rb +561 -0
- data/lib/dh_easy/core/mock/fake_executor.rb +373 -0
- data/lib/dh_easy/core/mock/fake_finisher.rb +28 -0
- data/lib/dh_easy/core/mock/fake_parser.rb +33 -0
- data/lib/dh_easy/core/mock/fake_seeder.rb +28 -0
- data/lib/dh_easy/core/plugin.rb +19 -0
- data/lib/dh_easy/core/plugin/collection_vault.rb +23 -0
- data/lib/dh_easy/core/plugin/config_behavior.rb +43 -0
- data/lib/dh_easy/core/plugin/context_integrator.rb +60 -0
- data/lib/dh_easy/core/plugin/executor.rb +19 -0
- data/lib/dh_easy/core/plugin/executor_behavior.rb +32 -0
- data/lib/dh_easy/core/plugin/finisher.rb +19 -0
- data/lib/dh_easy/core/plugin/finisher_behavior.rb +9 -0
- data/lib/dh_easy/core/plugin/initialize_hook.rb +17 -0
- data/lib/dh_easy/core/plugin/parser.rb +19 -0
- data/lib/dh_easy/core/plugin/parser_behavior.rb +17 -0
- data/lib/dh_easy/core/plugin/seeder.rb +44 -0
- data/lib/dh_easy/core/plugin/seeder_behavior.rb +9 -0
- data/lib/dh_easy/core/smart_collection.rb +236 -0
- data/lib/dh_easy/core/version.rb +6 -0
- metadata +249 -0
@@ -0,0 +1,282 @@
|
|
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: DhEasy::Core::Mock
|
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 = "DhEasy::Core::Mock";
|
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 (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span> » <span class='title'><span class='object_link'><a href="../Core.html" title="DhEasy::Core (module)">Core</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Mock</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: DhEasy::Core::Mock
|
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/dh_easy/core/mock.rb<span class="defines">,<br />
|
82
|
+
lib/dh_easy/core/mock/fake_db.rb,<br /> lib/dh_easy/core/mock/fake_parser.rb,<br /> lib/dh_easy/core/mock/fake_seeder.rb,<br /> lib/dh_easy/core/mock/fake_executor.rb,<br /> lib/dh_easy/core/mock/fake_finisher.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="Mock/FakeExecutor.html" title="DhEasy::Core::Mock::FakeExecutor (module)">FakeExecutor</a></span>
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Mock/FakeDb.html" title="DhEasy::Core::Mock::FakeDb (class)">FakeDb</a></span>, <span class='object_link'><a href="Mock/FakeFinisher.html" title="DhEasy::Core::Mock::FakeFinisher (class)">FakeFinisher</a></span>, <span class='object_link'><a href="Mock/FakeParser.html" title="DhEasy::Core::Mock::FakeParser (class)">FakeParser</a></span>, <span class='object_link'><a href="Mock/FakeSeeder.html" title="DhEasy::Core::Mock::FakeSeeder (class)">FakeSeeder</a></span>
|
97
|
+
|
98
|
+
|
99
|
+
</p>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<h2>
|
109
|
+
Class Method Summary
|
110
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
111
|
+
</h2>
|
112
|
+
|
113
|
+
<ul class="summary">
|
114
|
+
|
115
|
+
<li class="public ">
|
116
|
+
<span class="summary_signature">
|
117
|
+
|
118
|
+
<a href="#context_vars-class_method" title="context_vars (class method)">.<strong>context_vars</strong>(exposed_methods) ⇒ Array </a>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
</span>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<span class="summary_desc"><div class='inline'>
|
133
|
+
<p>Generate a context and message queue from a list of exposed methods.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<div id="class_method_details" class="method_details_list">
|
145
|
+
<h2>Class Method Details</h2>
|
146
|
+
|
147
|
+
|
148
|
+
<div class="method_details first">
|
149
|
+
<h3 class="signature first" id="context_vars-class_method">
|
150
|
+
|
151
|
+
.<strong>context_vars</strong>(exposed_methods) ⇒ <tt>Array</tt>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</h3><div class="docstring">
|
158
|
+
<div class="discussion">
|
159
|
+
|
160
|
+
<p>Generate a context and message queue from a list of exposed methods.</p>
|
161
|
+
|
162
|
+
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
<div class="tags">
|
166
|
+
|
167
|
+
<div class="examples">
|
168
|
+
<p class="tag_title">Examples:</p>
|
169
|
+
|
170
|
+
|
171
|
+
<pre class="example code"><code><span class='id identifier rubyid_exposed_methods'>exposed_methods</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:boo</span><span class='comma'>,</span> <span class='symbol'>:bar</span><span class='rbracket'>]</span>
|
172
|
+
<span class='id identifier rubyid_context'>context</span><span class='comma'>,</span> <span class='id identifier rubyid_message_queue'>message_queue</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core::Mock (module)">Mock</a></span></span><span class='period'>.</span><span class='id identifier rubyid_context_vars'>context_vars</span> <span class='id identifier rubyid_exposed_methods'>exposed_methods</span>
|
173
|
+
<span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_boo'>boo</span> <span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span>
|
174
|
+
<span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_bar'>bar</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='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>B</span><span class='tstring_end'>'</span></span>
|
175
|
+
<span class='id identifier rubyid_context'>context</span><span class='period'>.</span><span class='id identifier rubyid_bar'>bar</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>111</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>222</span><span class='tstring_end'>'</span></span>
|
176
|
+
<span class='id identifier rubyid_message_queue'>message_queue</span>
|
177
|
+
<span class='comment'># => [
|
178
|
+
</span><span class='comment'># [:boo, [1, 2]],
|
179
|
+
</span><span class='comment'># [:bar, ['A', 'B']],
|
180
|
+
</span><span class='comment'># [:bar, ['111', '222']]
|
181
|
+
</span><span class='comment'># ]</span></code></pre>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
<p class="tag_title">Parameters:</p>
|
185
|
+
<ul class="param">
|
186
|
+
|
187
|
+
<li>
|
188
|
+
|
189
|
+
<span class='name'>exposed_methods</span>
|
190
|
+
|
191
|
+
|
192
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
—
|
197
|
+
<div class='inline'>
|
198
|
+
<p>List of exposed methods.</p>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</li>
|
202
|
+
|
203
|
+
</ul>
|
204
|
+
|
205
|
+
<p class="tag_title">Returns:</p>
|
206
|
+
<ul class="return">
|
207
|
+
|
208
|
+
<li>
|
209
|
+
|
210
|
+
|
211
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
—
|
216
|
+
<div class='inline'>
|
217
|
+
<p>`[context, message_queue]` being:</p>
|
218
|
+
<ul><li>
|
219
|
+
<p>`context`: Object implementing exposed methods.</p>
|
220
|
+
</li><li>
|
221
|
+
<p>`[Array] message_queue`: Array to store messages.</p>
|
222
|
+
</li></ul>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
</li>
|
226
|
+
|
227
|
+
</ul>
|
228
|
+
|
229
|
+
</div><table class="source_code">
|
230
|
+
<tr>
|
231
|
+
<td>
|
232
|
+
<pre class="lines">
|
233
|
+
|
234
|
+
|
235
|
+
30
|
236
|
+
31
|
237
|
+
32
|
238
|
+
33
|
239
|
+
34
|
240
|
+
35
|
241
|
+
36
|
242
|
+
37
|
243
|
+
38
|
244
|
+
39
|
245
|
+
40
|
246
|
+
41
|
247
|
+
42</pre>
|
248
|
+
</td>
|
249
|
+
<td>
|
250
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock.rb', line 30</span>
|
251
|
+
|
252
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_context_vars'>context_vars</span> <span class='id identifier rubyid_exposed_methods'>exposed_methods</span>
|
253
|
+
<span class='id identifier rubyid_context'>context</span> <span class='op'>=</span> <span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
254
|
+
<span class='id identifier rubyid_metaclass'>metaclass</span> <span class='op'>=</span> <span class='kw'>class</span> <span class='op'><<</span> <span class='id identifier rubyid_context'>context</span><span class='semicolon'>;</span> <span class='kw'>self</span><span class='semicolon'>;</span> <span class='kw'>end</span>
|
255
|
+
<span class='id identifier rubyid_message_queue'>message_queue</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='comment'># Beat reference bug
|
256
|
+
</span> <span class='id identifier rubyid_exposed_methods'>exposed_methods</span> <span class='op'>=</span> <span class='id identifier rubyid_exposed_methods'>exposed_methods</span>
|
257
|
+
<span class='id identifier rubyid_exposed_methods'>exposed_methods</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
|
258
|
+
<span class='id identifier rubyid_metaclass'>metaclass</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:define_method</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='op'>|</span>
|
259
|
+
<span class='comment'># Record all method calls into message queue for easy access
|
260
|
+
</span> <span class='id identifier rubyid_message_queue'>message_queue</span> <span class='op'><<</span> <span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rbracket'>]</span>
|
261
|
+
<span class='kw'>end</span>
|
262
|
+
<span class='kw'>end</span>
|
263
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_context'>context</span><span class='comma'>,</span> <span class='id identifier rubyid_message_queue'>message_queue</span><span class='rbracket'>]</span>
|
264
|
+
<span class='kw'>end</span></pre>
|
265
|
+
</td>
|
266
|
+
</tr>
|
267
|
+
</table>
|
268
|
+
</div>
|
269
|
+
|
270
|
+
</div>
|
271
|
+
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div id="footer">
|
275
|
+
Generated on Wed Dec 4 23:00:02 2019 by
|
276
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
277
|
+
0.9.20 (ruby-2.5.3).
|
278
|
+
</div>
|
279
|
+
|
280
|
+
</div>
|
281
|
+
</body>
|
282
|
+
</html>
|
@@ -0,0 +1,3779 @@
|
|
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
|
+
Class: DhEasy::Core::Mock::FakeDb
|
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 = "DhEasy::Core::Mock::FakeDb";
|
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 (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span> » <span class='title'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span> » <span class='title'><span class='object_link'><a href="../Mock.html" title="DhEasy::Core::Mock (module)">Mock</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">FakeDb</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>Class: DhEasy::Core::Mock::FakeDb
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">DhEasy::Core::Mock::FakeDb</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/dh_easy/core/mock/fake_db.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Fake in memory database that emulates `DataHen` database objects' black
|
106
|
+
box behavior.</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<h2>
|
117
|
+
Constant Summary
|
118
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
119
|
+
</h2>
|
120
|
+
|
121
|
+
<dl class="constants">
|
122
|
+
|
123
|
+
<dt id="PAGE_KEYS-constant" class="">PAGE_KEYS =
|
124
|
+
<div class="docstring">
|
125
|
+
<div class="discussion">
|
126
|
+
|
127
|
+
<p>Page id keys, analog to primary keys.</p>
|
128
|
+
|
129
|
+
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
<div class="tags">
|
133
|
+
|
134
|
+
|
135
|
+
</div>
|
136
|
+
</dt>
|
137
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gid</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
138
|
+
|
139
|
+
<dt id="OUTPUT_KEYS-constant" class="">OUTPUT_KEYS =
|
140
|
+
<div class="docstring">
|
141
|
+
<div class="discussion">
|
142
|
+
|
143
|
+
<p>Output id keys, analog to primary keys.</p>
|
144
|
+
|
145
|
+
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
<div class="tags">
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
</dt>
|
153
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_id</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_collection</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
154
|
+
|
155
|
+
<dt id="JOB_KEYS-constant" class="">JOB_KEYS =
|
156
|
+
<div class="docstring">
|
157
|
+
<div class="discussion">
|
158
|
+
|
159
|
+
<p>Job id keys, analog to primary keys.</p>
|
160
|
+
|
161
|
+
|
162
|
+
</div>
|
163
|
+
</div>
|
164
|
+
<div class="tags">
|
165
|
+
|
166
|
+
|
167
|
+
</div>
|
168
|
+
</dt>
|
169
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
170
|
+
|
171
|
+
<dt id="JOB_STATUSES-constant" class="">JOB_STATUSES =
|
172
|
+
<div class="docstring">
|
173
|
+
<div class="discussion">
|
174
|
+
|
175
|
+
<p>Job available status.</p>
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
<div class="tags">
|
181
|
+
|
182
|
+
|
183
|
+
</div>
|
184
|
+
</dt>
|
185
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
186
|
+
<span class='label'>active:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>active</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
187
|
+
<span class='label'>done:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>done</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
188
|
+
<span class='label'>cancelled:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cancelled</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
189
|
+
<span class='label'>paused:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>paused</span><span class='tstring_end'>'</span></span>
|
190
|
+
<span class='rbrace'>}</span></pre></dd>
|
191
|
+
|
192
|
+
<dt id="DEFAULT_COLLECTION-constant" class="">DEFAULT_COLLECTION =
|
193
|
+
<div class="docstring">
|
194
|
+
<div class="discussion">
|
195
|
+
|
196
|
+
<p>Default collection for saved outputs</p>
|
197
|
+
|
198
|
+
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
<div class="tags">
|
202
|
+
|
203
|
+
|
204
|
+
</div>
|
205
|
+
</dt>
|
206
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>default</span><span class='tstring_end'>'</span></span></pre></dd>
|
207
|
+
|
208
|
+
</dl>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<h2>
|
219
|
+
Class Method Summary
|
220
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
221
|
+
</h2>
|
222
|
+
|
223
|
+
<ul class="summary">
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#build_fake_job-class_method" title="build_fake_job (class method)">.<strong>build_fake_job</strong>(opts = {}) ⇒ Hash </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'>
|
243
|
+
<p>Build a fake job by using FakeDb engine.</p>
|
244
|
+
</div></span>
|
245
|
+
|
246
|
+
</li>
|
247
|
+
|
248
|
+
|
249
|
+
<li class="public ">
|
250
|
+
<span class="summary_signature">
|
251
|
+
|
252
|
+
<a href="#build_fake_page-class_method" title="build_fake_page (class method)">.<strong>build_fake_page</strong>(opts = {}) ⇒ Hash </a>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'>
|
267
|
+
<p>Build a fake page by using FakeDb engine.</p>
|
268
|
+
</div></span>
|
269
|
+
|
270
|
+
</li>
|
271
|
+
|
272
|
+
|
273
|
+
<li class="public ">
|
274
|
+
<span class="summary_signature">
|
275
|
+
|
276
|
+
<a href="#build_job-class_method" title="build_job (class method)">.<strong>build_job</strong>(job, opts = {}) ⇒ Hash </a>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</span>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
<span class="summary_desc"><div class='inline'>
|
291
|
+
<p>Build a job with defaults by using FakeDb engine.</p>
|
292
|
+
</div></span>
|
293
|
+
|
294
|
+
</li>
|
295
|
+
|
296
|
+
|
297
|
+
<li class="public ">
|
298
|
+
<span class="summary_signature">
|
299
|
+
|
300
|
+
<a href="#build_page-class_method" title="build_page (class method)">.<strong>build_page</strong>(page, opts = {}) ⇒ Hash </a>
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
</span>
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
<span class="summary_desc"><div class='inline'>
|
315
|
+
<p>Build a page with defaults by using FakeDb engine.</p>
|
316
|
+
</div></span>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
|
321
|
+
<li class="public ">
|
322
|
+
<span class="summary_signature">
|
323
|
+
|
324
|
+
<a href="#clean_uri-class_method" title="clean_uri (class method)">.<strong>clean_uri</strong>(raw_url) ⇒ String </a>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</span>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
<span class="summary_desc"><div class='inline'>
|
339
|
+
<p>Clean an URL to remove fragment, lowercase schema and host, and sort
|
340
|
+
query string.</p>
|
341
|
+
</div></span>
|
342
|
+
|
343
|
+
</li>
|
344
|
+
|
345
|
+
|
346
|
+
<li class="public ">
|
347
|
+
<span class="summary_signature">
|
348
|
+
|
349
|
+
<a href="#fake_uuid-class_method" title="fake_uuid (class method)">.<strong>fake_uuid</strong>(seed = nil) ⇒ String </a>
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
</span>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
<span class="summary_desc"><div class='inline'>
|
364
|
+
<p>Generate a fake UUID.</p>
|
365
|
+
</div></span>
|
366
|
+
|
367
|
+
</li>
|
368
|
+
|
369
|
+
|
370
|
+
<li class="public ">
|
371
|
+
<span class="summary_signature">
|
372
|
+
|
373
|
+
<a href="#new_collection-class_method" title="new_collection (class method)">.<strong>new_collection</strong>(keys, opts = {}) ⇒ DhEasy::Core::SmartCollection </a>
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
</span>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
<span class="summary_desc"><div class='inline'>
|
388
|
+
<p>Generate a smart collection with keys and initial values.</p>
|
389
|
+
</div></span>
|
390
|
+
|
391
|
+
</li>
|
392
|
+
|
393
|
+
|
394
|
+
<li class="public ">
|
395
|
+
<span class="summary_signature">
|
396
|
+
|
397
|
+
<a href="#output_uuid-class_method" title="output_uuid (class method)">.<strong>output_uuid</strong>(data) ⇒ String </a>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
</span>
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
<span class="summary_desc"><div class='inline'>
|
412
|
+
<p>Generate a fake UUID based on output fields without `_` prefix.</p>
|
413
|
+
</div></span>
|
414
|
+
|
415
|
+
</li>
|
416
|
+
|
417
|
+
|
418
|
+
<li class="public ">
|
419
|
+
<span class="summary_signature">
|
420
|
+
|
421
|
+
<a href="#time_stamp-class_method" title="time_stamp (class method)">.<strong>time_stamp</strong>(time = nil) ⇒ String </a>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
</span>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
<span class="summary_desc"><div class='inline'>
|
436
|
+
<p>Return a timestamp.</p>
|
437
|
+
</div></span>
|
438
|
+
|
439
|
+
</li>
|
440
|
+
|
441
|
+
|
442
|
+
</ul>
|
443
|
+
|
444
|
+
<h2>
|
445
|
+
Instance Method Summary
|
446
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
447
|
+
</h2>
|
448
|
+
|
449
|
+
<ul class="summary">
|
450
|
+
|
451
|
+
<li class="public ">
|
452
|
+
<span class="summary_signature">
|
453
|
+
|
454
|
+
<a href="#allow_job_id_override%3F-instance_method" title="#allow_job_id_override? (instance method)">#<strong>allow_job_id_override?</strong> ⇒ Boolean </a>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
</span>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
<span class="summary_desc"><div class='inline'>
|
469
|
+
<p>Specify whenever job id overriding by user is allowed on page or output
|
470
|
+
insert.</p>
|
471
|
+
</div></span>
|
472
|
+
|
473
|
+
</li>
|
474
|
+
|
475
|
+
|
476
|
+
<li class="public ">
|
477
|
+
<span class="summary_signature">
|
478
|
+
|
479
|
+
<a href="#allow_page_gid_override%3F-instance_method" title="#allow_page_gid_override? (instance method)">#<strong>allow_page_gid_override?</strong> ⇒ Boolean </a>
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
</span>
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
<span class="summary_desc"><div class='inline'>
|
494
|
+
<p>Specify whenever page gid overriding by user is allowed on page or output
|
495
|
+
insert.</p>
|
496
|
+
</div></span>
|
497
|
+
|
498
|
+
</li>
|
499
|
+
|
500
|
+
|
501
|
+
<li class="public ">
|
502
|
+
<span class="summary_signature">
|
503
|
+
|
504
|
+
<a href="#disable_job_id_override-instance_method" title="#disable_job_id_override (instance method)">#<strong>disable_job_id_override</strong> ⇒ Object </a>
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
</span>
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
<span class="summary_desc"><div class='inline'>
|
519
|
+
<p>Disable job id override on page or output insert.</p>
|
520
|
+
</div></span>
|
521
|
+
|
522
|
+
</li>
|
523
|
+
|
524
|
+
|
525
|
+
<li class="public ">
|
526
|
+
<span class="summary_signature">
|
527
|
+
|
528
|
+
<a href="#disable_page_gid_override-instance_method" title="#disable_page_gid_override (instance method)">#<strong>disable_page_gid_override</strong> ⇒ Object </a>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
</span>
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
<span class="summary_desc"><div class='inline'>
|
543
|
+
<p>Disable page gid override on page or output insert.</p>
|
544
|
+
</div></span>
|
545
|
+
|
546
|
+
</li>
|
547
|
+
|
548
|
+
|
549
|
+
<li class="public ">
|
550
|
+
<span class="summary_signature">
|
551
|
+
|
552
|
+
<a href="#enable_job_id_override-instance_method" title="#enable_job_id_override (instance method)">#<strong>enable_job_id_override</strong> ⇒ Object </a>
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
</span>
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
<span class="summary_desc"><div class='inline'>
|
567
|
+
<p>Enable job id override on page or output insert.</p>
|
568
|
+
</div></span>
|
569
|
+
|
570
|
+
</li>
|
571
|
+
|
572
|
+
|
573
|
+
<li class="public ">
|
574
|
+
<span class="summary_signature">
|
575
|
+
|
576
|
+
<a href="#enable_page_gid_override-instance_method" title="#enable_page_gid_override (instance method)">#<strong>enable_page_gid_override</strong> ⇒ Object </a>
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
</span>
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
<span class="summary_desc"><div class='inline'>
|
591
|
+
<p>Enable page gid override on page or output insert.</p>
|
592
|
+
</div></span>
|
593
|
+
|
594
|
+
</li>
|
595
|
+
|
596
|
+
|
597
|
+
<li class="public ">
|
598
|
+
<span class="summary_signature">
|
599
|
+
|
600
|
+
<a href="#ensure_job-instance_method" title="#ensure_job (instance method)">#<strong>ensure_job</strong>(target_job_id = nil) ⇒ Hash </a>
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
</span>
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
<span class="summary_desc"><div class='inline'>
|
615
|
+
<p>Get current job or create new one from values.</p>
|
616
|
+
</div></span>
|
617
|
+
|
618
|
+
</li>
|
619
|
+
|
620
|
+
|
621
|
+
<li class="public ">
|
622
|
+
<span class="summary_signature">
|
623
|
+
|
624
|
+
<a href="#generate_job_id-instance_method" title="#generate_job_id (instance method)">#<strong>generate_job_id</strong> ⇒ Integer </a>
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
</span>
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
<span class="summary_desc"><div class='inline'>
|
639
|
+
<p>Generate a fake job_id.</p>
|
640
|
+
</div></span>
|
641
|
+
|
642
|
+
</li>
|
643
|
+
|
644
|
+
|
645
|
+
<li class="public ">
|
646
|
+
<span class="summary_signature">
|
647
|
+
|
648
|
+
<a href="#generate_output_id-instance_method" title="#generate_output_id (instance method)">#<strong>generate_output_id</strong>(data) ⇒ String </a>
|
649
|
+
|
650
|
+
|
651
|
+
|
652
|
+
</span>
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
<span class="summary_desc"><div class='inline'>
|
663
|
+
<p>Generate a fake UUID for outputs.</p>
|
664
|
+
</div></span>
|
665
|
+
|
666
|
+
</li>
|
667
|
+
|
668
|
+
|
669
|
+
<li class="public ">
|
670
|
+
<span class="summary_signature">
|
671
|
+
|
672
|
+
<a href="#generate_page_gid-instance_method" title="#generate_page_gid (instance method)">#<strong>generate_page_gid</strong>(page_data) ⇒ String </a>
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
</span>
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
<span class="summary_desc"><div class='inline'>
|
687
|
+
<p>Generate a fake UUID based on page data: * url * method * headers *
|
688
|
+
fetch_type * cookie * no_redirect * body * ua_type.</p>
|
689
|
+
</div></span>
|
690
|
+
|
691
|
+
</li>
|
692
|
+
|
693
|
+
|
694
|
+
<li class="public ">
|
695
|
+
<span class="summary_signature">
|
696
|
+
|
697
|
+
<a href="#generate_scraper_name-instance_method" title="#generate_scraper_name (instance method)">#<strong>generate_scraper_name</strong> ⇒ String </a>
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
</span>
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
<span class="summary_desc"><div class='inline'>
|
712
|
+
<p>Generate a fake scraper name.</p>
|
713
|
+
</div></span>
|
714
|
+
|
715
|
+
</li>
|
716
|
+
|
717
|
+
|
718
|
+
<li class="public ">
|
719
|
+
<span class="summary_signature">
|
720
|
+
|
721
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(opts = {}) ⇒ FakeDb </a>
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
</span>
|
726
|
+
|
727
|
+
|
728
|
+
<span class="note title constructor">constructor</span>
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
<span class="summary_desc"><div class='inline'>
|
738
|
+
<p>Initialize fake database.</p>
|
739
|
+
</div></span>
|
740
|
+
|
741
|
+
</li>
|
742
|
+
|
743
|
+
|
744
|
+
<li class="public ">
|
745
|
+
<span class="summary_signature">
|
746
|
+
|
747
|
+
<a href="#job_id-instance_method" title="#job_id (instance method)">#<strong>job_id</strong> ⇒ Integer<sup>?</sup> </a>
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
</span>
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
<span class="summary_desc"><div class='inline'>
|
762
|
+
<p>Fake job id.</p>
|
763
|
+
</div></span>
|
764
|
+
|
765
|
+
</li>
|
766
|
+
|
767
|
+
|
768
|
+
<li class="public ">
|
769
|
+
<span class="summary_signature">
|
770
|
+
|
771
|
+
<a href="#job_id=-instance_method" title="#job_id= (instance method)">#<strong>job_id=</strong>(value) ⇒ Object </a>
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
</span>
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
|
783
|
+
|
784
|
+
|
785
|
+
<span class="summary_desc"><div class='inline'>
|
786
|
+
<p>Set fake job id value.</p>
|
787
|
+
</div></span>
|
788
|
+
|
789
|
+
</li>
|
790
|
+
|
791
|
+
|
792
|
+
<li class="public ">
|
793
|
+
<span class="summary_signature">
|
794
|
+
|
795
|
+
<a href="#jobs-instance_method" title="#jobs (instance method)">#<strong>jobs</strong> ⇒ DhEasy::Core::SmartCollection </a>
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
</span>
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
|
808
|
+
|
809
|
+
<span class="summary_desc"><div class='inline'>
|
810
|
+
<p>Stored job collection.</p>
|
811
|
+
</div></span>
|
812
|
+
|
813
|
+
</li>
|
814
|
+
|
815
|
+
|
816
|
+
<li class="public ">
|
817
|
+
<span class="summary_signature">
|
818
|
+
|
819
|
+
<a href="#outputs-instance_method" title="#outputs (instance method)">#<strong>outputs</strong> ⇒ DhEasy::Core::SmartCollection </a>
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
</span>
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
<span class="summary_desc"><div class='inline'>
|
834
|
+
<p>Stored output collection.</p>
|
835
|
+
</div></span>
|
836
|
+
|
837
|
+
</li>
|
838
|
+
|
839
|
+
|
840
|
+
<li class="public ">
|
841
|
+
<span class="summary_signature">
|
842
|
+
|
843
|
+
<a href="#page_gid-instance_method" title="#page_gid (instance method)">#<strong>page_gid</strong> ⇒ Integer<sup>?</sup> </a>
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
</span>
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
|
853
|
+
|
854
|
+
|
855
|
+
|
856
|
+
|
857
|
+
<span class="summary_desc"><div class='inline'>
|
858
|
+
<p>Current fake page gid.</p>
|
859
|
+
</div></span>
|
860
|
+
|
861
|
+
</li>
|
862
|
+
|
863
|
+
|
864
|
+
<li class="public ">
|
865
|
+
<span class="summary_signature">
|
866
|
+
|
867
|
+
<a href="#page_gid=-instance_method" title="#page_gid= (instance method)">#<strong>page_gid=</strong>(value) ⇒ Object </a>
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
</span>
|
872
|
+
|
873
|
+
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
|
881
|
+
<span class="summary_desc"><div class='inline'>
|
882
|
+
<p>Set current fake page gid value.</p>
|
883
|
+
</div></span>
|
884
|
+
|
885
|
+
</li>
|
886
|
+
|
887
|
+
|
888
|
+
<li class="public ">
|
889
|
+
<span class="summary_signature">
|
890
|
+
|
891
|
+
<a href="#pages-instance_method" title="#pages (instance method)">#<strong>pages</strong> ⇒ DhEasy::Core::SmartCollection </a>
|
892
|
+
|
893
|
+
|
894
|
+
|
895
|
+
</span>
|
896
|
+
|
897
|
+
|
898
|
+
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
|
905
|
+
<span class="summary_desc"><div class='inline'>
|
906
|
+
<p>Stored page collection.</p>
|
907
|
+
</div></span>
|
908
|
+
|
909
|
+
</li>
|
910
|
+
|
911
|
+
|
912
|
+
<li class="public ">
|
913
|
+
<span class="summary_signature">
|
914
|
+
|
915
|
+
<a href="#query-instance_method" title="#query (instance method)">#<strong>query</strong>(collection, filter, offset = 0, limit = nil) ⇒ Object </a>
|
916
|
+
|
917
|
+
|
918
|
+
|
919
|
+
</span>
|
920
|
+
|
921
|
+
|
922
|
+
|
923
|
+
|
924
|
+
|
925
|
+
|
926
|
+
|
927
|
+
|
928
|
+
|
929
|
+
<span class="summary_desc"><div class='inline'>
|
930
|
+
<p>Search items from a collection.</p>
|
931
|
+
</div></span>
|
932
|
+
|
933
|
+
</li>
|
934
|
+
|
935
|
+
|
936
|
+
<li class="public ">
|
937
|
+
<span class="summary_signature">
|
938
|
+
|
939
|
+
<a href="#refetch-instance_method" title="#refetch (instance method)">#<strong>refetch</strong>(job_id, gid) ⇒ Object </a>
|
940
|
+
|
941
|
+
|
942
|
+
|
943
|
+
</span>
|
944
|
+
|
945
|
+
|
946
|
+
|
947
|
+
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
|
952
|
+
|
953
|
+
<span class="summary_desc"><div class='inline'>
|
954
|
+
<p>Refetch a page.</p>
|
955
|
+
</div></span>
|
956
|
+
|
957
|
+
</li>
|
958
|
+
|
959
|
+
|
960
|
+
<li class="public ">
|
961
|
+
<span class="summary_signature">
|
962
|
+
|
963
|
+
<a href="#reparse-instance_method" title="#reparse (instance method)">#<strong>reparse</strong>(job_id, gid) ⇒ Object </a>
|
964
|
+
|
965
|
+
|
966
|
+
|
967
|
+
</span>
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
|
973
|
+
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
<span class="summary_desc"><div class='inline'>
|
978
|
+
<p>Reparse a page.</p>
|
979
|
+
</div></span>
|
980
|
+
|
981
|
+
</li>
|
982
|
+
|
983
|
+
|
984
|
+
<li class="public ">
|
985
|
+
<span class="summary_signature">
|
986
|
+
|
987
|
+
<a href="#scraper_name-instance_method" title="#scraper_name (instance method)">#<strong>scraper_name</strong> ⇒ String<sup>?</sup> </a>
|
988
|
+
|
989
|
+
|
990
|
+
|
991
|
+
</span>
|
992
|
+
|
993
|
+
|
994
|
+
|
995
|
+
|
996
|
+
|
997
|
+
|
998
|
+
|
999
|
+
|
1000
|
+
|
1001
|
+
<span class="summary_desc"><div class='inline'>
|
1002
|
+
<p>Fake scraper_name.</p>
|
1003
|
+
</div></span>
|
1004
|
+
|
1005
|
+
</li>
|
1006
|
+
|
1007
|
+
|
1008
|
+
<li class="public ">
|
1009
|
+
<span class="summary_signature">
|
1010
|
+
|
1011
|
+
<a href="#scraper_name=-instance_method" title="#scraper_name= (instance method)">#<strong>scraper_name=</strong>(value) ⇒ Object </a>
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
</span>
|
1016
|
+
|
1017
|
+
|
1018
|
+
|
1019
|
+
|
1020
|
+
|
1021
|
+
|
1022
|
+
|
1023
|
+
|
1024
|
+
|
1025
|
+
<span class="summary_desc"><div class='inline'>
|
1026
|
+
<p>Set fake scraper_name value.</p>
|
1027
|
+
</div></span>
|
1028
|
+
|
1029
|
+
</li>
|
1030
|
+
|
1031
|
+
|
1032
|
+
</ul>
|
1033
|
+
|
1034
|
+
|
1035
|
+
<div id="constructor_details" class="method_details_list">
|
1036
|
+
<h2>Constructor Details</h2>
|
1037
|
+
|
1038
|
+
<div class="method_details first">
|
1039
|
+
<h3 class="signature first" id="initialize-instance_method">
|
1040
|
+
|
1041
|
+
#<strong>initialize</strong>(opts = {}) ⇒ <tt><span class='object_link'><a href="" title="DhEasy::Core::Mock::FakeDb (class)">FakeDb</a></span></tt>
|
1042
|
+
|
1043
|
+
|
1044
|
+
|
1045
|
+
|
1046
|
+
|
1047
|
+
</h3><div class="docstring">
|
1048
|
+
<div class="discussion">
|
1049
|
+
|
1050
|
+
<p>Initialize fake database.</p>
|
1051
|
+
|
1052
|
+
|
1053
|
+
</div>
|
1054
|
+
</div>
|
1055
|
+
<div class="tags">
|
1056
|
+
<p class="tag_title">Parameters:</p>
|
1057
|
+
<ul class="param">
|
1058
|
+
|
1059
|
+
<li>
|
1060
|
+
|
1061
|
+
<span class='name'>opts</span>
|
1062
|
+
|
1063
|
+
|
1064
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1065
|
+
|
1066
|
+
|
1067
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1068
|
+
|
1069
|
+
|
1070
|
+
—
|
1071
|
+
<div class='inline'>
|
1072
|
+
<p>({}) Configuration options.</p>
|
1073
|
+
</div>
|
1074
|
+
|
1075
|
+
</li>
|
1076
|
+
|
1077
|
+
</ul>
|
1078
|
+
|
1079
|
+
|
1080
|
+
|
1081
|
+
|
1082
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
1083
|
+
<ul class="option">
|
1084
|
+
|
1085
|
+
<li>
|
1086
|
+
<span class="name">:job_id</span>
|
1087
|
+
<span class="type">(<tt>Integer</tt>, <tt>nil</tt>)</span>
|
1088
|
+
<span class="default">
|
1089
|
+
|
1090
|
+
</span>
|
1091
|
+
|
1092
|
+
— <div class='inline'>
|
1093
|
+
<p>Job id default value.</p>
|
1094
|
+
</div>
|
1095
|
+
|
1096
|
+
</li>
|
1097
|
+
|
1098
|
+
<li>
|
1099
|
+
<span class="name">:scraper_name</span>
|
1100
|
+
<span class="type">(<tt>String</tt>, <tt>nil</tt>)</span>
|
1101
|
+
<span class="default">
|
1102
|
+
|
1103
|
+
</span>
|
1104
|
+
|
1105
|
+
— <div class='inline'>
|
1106
|
+
<p>Scraper name default value.</p>
|
1107
|
+
</div>
|
1108
|
+
|
1109
|
+
</li>
|
1110
|
+
|
1111
|
+
<li>
|
1112
|
+
<span class="name">:page_gid</span>
|
1113
|
+
<span class="type">(<tt>String</tt>, <tt>nil</tt>)</span>
|
1114
|
+
<span class="default">
|
1115
|
+
|
1116
|
+
</span>
|
1117
|
+
|
1118
|
+
— <div class='inline'>
|
1119
|
+
<p>Page gid default value.</p>
|
1120
|
+
</div>
|
1121
|
+
|
1122
|
+
</li>
|
1123
|
+
|
1124
|
+
<li>
|
1125
|
+
<span class="name">:allow_page_gid_override</span>
|
1126
|
+
<span class="type">(<tt>Boolean</tt>, <tt>nil</tt>)</span>
|
1127
|
+
<span class="default">
|
1128
|
+
|
1129
|
+
— default:
|
1130
|
+
<tt>false</tt>
|
1131
|
+
|
1132
|
+
</span>
|
1133
|
+
|
1134
|
+
— <div class='inline'>
|
1135
|
+
<p>Specify whenever page gid can be overrided on page or output insert.</p>
|
1136
|
+
</div>
|
1137
|
+
|
1138
|
+
</li>
|
1139
|
+
|
1140
|
+
<li>
|
1141
|
+
<span class="name">:allow_job_id_override</span>
|
1142
|
+
<span class="type">(<tt>Boolean</tt>, <tt>nil</tt>)</span>
|
1143
|
+
<span class="default">
|
1144
|
+
|
1145
|
+
— default:
|
1146
|
+
<tt>false</tt>
|
1147
|
+
|
1148
|
+
</span>
|
1149
|
+
|
1150
|
+
— <div class='inline'>
|
1151
|
+
<p>Specify whenever job id can be overrided on page or output insert.</p>
|
1152
|
+
</div>
|
1153
|
+
|
1154
|
+
</li>
|
1155
|
+
|
1156
|
+
</ul>
|
1157
|
+
|
1158
|
+
|
1159
|
+
|
1160
|
+
</div><table class="source_code">
|
1161
|
+
<tr>
|
1162
|
+
<td>
|
1163
|
+
<pre class="lines">
|
1164
|
+
|
1165
|
+
|
1166
|
+
266
|
1167
|
+
267
|
1168
|
+
268
|
1169
|
+
269
|
1170
|
+
270
|
1171
|
+
271
|
1172
|
+
272</pre>
|
1173
|
+
</td>
|
1174
|
+
<td>
|
1175
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 266</span>
|
1176
|
+
|
1177
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1178
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_job_id'>job_id</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:job_id</span><span class='rbracket'>]</span>
|
1179
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_scraper_name'>scraper_name</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:scraper_name</span><span class='rbracket'>]</span>
|
1180
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_page_gid'>page_gid</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:page_gid</span><span class='rbracket'>]</span>
|
1181
|
+
<span class='ivar'>@allow_page_gid_override</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:allow_page_gid_override</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='op'>!</span><span class='op'>!</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:allow_page_gid_override</span><span class='rbracket'>]</span>
|
1182
|
+
<span class='ivar'>@allow_job_id_override</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:allow_job_id_override</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='op'>!</span><span class='op'>!</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:allow_job_id_override</span><span class='rbracket'>]</span>
|
1183
|
+
<span class='kw'>end</span></pre>
|
1184
|
+
</td>
|
1185
|
+
</tr>
|
1186
|
+
</table>
|
1187
|
+
</div>
|
1188
|
+
|
1189
|
+
</div>
|
1190
|
+
|
1191
|
+
|
1192
|
+
<div id="class_method_details" class="method_details_list">
|
1193
|
+
<h2>Class Method Details</h2>
|
1194
|
+
|
1195
|
+
|
1196
|
+
<div class="method_details first">
|
1197
|
+
<h3 class="signature first" id="build_fake_job-class_method">
|
1198
|
+
|
1199
|
+
.<strong>build_fake_job</strong>(opts = {}) ⇒ <tt>Hash</tt>
|
1200
|
+
|
1201
|
+
|
1202
|
+
|
1203
|
+
|
1204
|
+
|
1205
|
+
</h3><div class="docstring">
|
1206
|
+
<div class="discussion">
|
1207
|
+
|
1208
|
+
<p>Build a fake job by using FakeDb engine.</p>
|
1209
|
+
|
1210
|
+
|
1211
|
+
</div>
|
1212
|
+
</div>
|
1213
|
+
<div class="tags">
|
1214
|
+
<p class="tag_title">Parameters:</p>
|
1215
|
+
<ul class="param">
|
1216
|
+
|
1217
|
+
<li>
|
1218
|
+
|
1219
|
+
<span class='name'>opts</span>
|
1220
|
+
|
1221
|
+
|
1222
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1223
|
+
|
1224
|
+
|
1225
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1226
|
+
|
1227
|
+
|
1228
|
+
—
|
1229
|
+
<div class='inline'>
|
1230
|
+
<p>({}) Configuration options (see #initialize).</p>
|
1231
|
+
</div>
|
1232
|
+
|
1233
|
+
</li>
|
1234
|
+
|
1235
|
+
</ul>
|
1236
|
+
|
1237
|
+
|
1238
|
+
|
1239
|
+
|
1240
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
1241
|
+
<ul class="option">
|
1242
|
+
|
1243
|
+
<li>
|
1244
|
+
<span class="name">:scraper_name</span>
|
1245
|
+
<span class="type">(<tt>String</tt>)</span>
|
1246
|
+
<span class="default">
|
1247
|
+
|
1248
|
+
— default:
|
1249
|
+
<tt>nil</tt>
|
1250
|
+
|
1251
|
+
</span>
|
1252
|
+
|
1253
|
+
— <div class='inline'>
|
1254
|
+
<p>Scraper name.</p>
|
1255
|
+
</div>
|
1256
|
+
|
1257
|
+
</li>
|
1258
|
+
|
1259
|
+
<li>
|
1260
|
+
<span class="name">:job_id</span>
|
1261
|
+
<span class="type">(<tt>Integer</tt>)</span>
|
1262
|
+
<span class="default">
|
1263
|
+
|
1264
|
+
— default:
|
1265
|
+
<tt>nil</tt>
|
1266
|
+
|
1267
|
+
</span>
|
1268
|
+
|
1269
|
+
— <div class='inline'>
|
1270
|
+
<p>Job id.</p>
|
1271
|
+
</div>
|
1272
|
+
|
1273
|
+
</li>
|
1274
|
+
|
1275
|
+
<li>
|
1276
|
+
<span class="name">:status</span>
|
1277
|
+
<span class="type">(<tt>String</tt>)</span>
|
1278
|
+
<span class="default">
|
1279
|
+
|
1280
|
+
— default:
|
1281
|
+
<tt>'done'</tt>
|
1282
|
+
|
1283
|
+
</span>
|
1284
|
+
|
1285
|
+
— <div class='inline'>
|
1286
|
+
<p>.</p>
|
1287
|
+
</div>
|
1288
|
+
|
1289
|
+
</li>
|
1290
|
+
|
1291
|
+
</ul>
|
1292
|
+
|
1293
|
+
|
1294
|
+
<p class="tag_title">Returns:</p>
|
1295
|
+
<ul class="return">
|
1296
|
+
|
1297
|
+
<li>
|
1298
|
+
|
1299
|
+
|
1300
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1301
|
+
|
1302
|
+
|
1303
|
+
|
1304
|
+
</li>
|
1305
|
+
|
1306
|
+
</ul>
|
1307
|
+
|
1308
|
+
</div><table class="source_code">
|
1309
|
+
<tr>
|
1310
|
+
<td>
|
1311
|
+
<pre class="lines">
|
1312
|
+
|
1313
|
+
|
1314
|
+
146
|
1315
|
+
147
|
1316
|
+
148
|
1317
|
+
149
|
1318
|
+
150
|
1319
|
+
151
|
1320
|
+
152
|
1321
|
+
153</pre>
|
1322
|
+
</td>
|
1323
|
+
<td>
|
1324
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 146</span>
|
1325
|
+
|
1326
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_build_fake_job'>build_fake_job</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1327
|
+
<span class='id identifier rubyid_job'>job</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1328
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:job_id</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1329
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>scraper_name</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:scraper_name</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
1330
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>status</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:status</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>done</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1331
|
+
<span class='rbrace'>}</span>
|
1332
|
+
<span class='id identifier rubyid_build_job'>build_job</span> <span class='id identifier rubyid_job'>job</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
|
1333
|
+
<span class='kw'>end</span></pre>
|
1334
|
+
</td>
|
1335
|
+
</tr>
|
1336
|
+
</table>
|
1337
|
+
</div>
|
1338
|
+
|
1339
|
+
<div class="method_details ">
|
1340
|
+
<h3 class="signature " id="build_fake_page-class_method">
|
1341
|
+
|
1342
|
+
.<strong>build_fake_page</strong>(opts = {}) ⇒ <tt>Hash</tt>
|
1343
|
+
|
1344
|
+
|
1345
|
+
|
1346
|
+
|
1347
|
+
|
1348
|
+
</h3><div class="docstring">
|
1349
|
+
<div class="discussion">
|
1350
|
+
|
1351
|
+
<p>Build a fake page by using FakeDb engine.</p>
|
1352
|
+
|
1353
|
+
|
1354
|
+
</div>
|
1355
|
+
</div>
|
1356
|
+
<div class="tags">
|
1357
|
+
<p class="tag_title">Parameters:</p>
|
1358
|
+
<ul class="param">
|
1359
|
+
|
1360
|
+
<li>
|
1361
|
+
|
1362
|
+
<span class='name'>opts</span>
|
1363
|
+
|
1364
|
+
|
1365
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1366
|
+
|
1367
|
+
|
1368
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1369
|
+
|
1370
|
+
|
1371
|
+
—
|
1372
|
+
<div class='inline'>
|
1373
|
+
<p>({}) Configuration options (see #initialize).</p>
|
1374
|
+
</div>
|
1375
|
+
|
1376
|
+
</li>
|
1377
|
+
|
1378
|
+
</ul>
|
1379
|
+
|
1380
|
+
|
1381
|
+
|
1382
|
+
|
1383
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
1384
|
+
<ul class="option">
|
1385
|
+
|
1386
|
+
<li>
|
1387
|
+
<span class="name">:url</span>
|
1388
|
+
<span class="type">(<tt>String</tt>)</span>
|
1389
|
+
<span class="default">
|
1390
|
+
|
1391
|
+
— default:
|
1392
|
+
<tt>'https://example.com'</tt>
|
1393
|
+
|
1394
|
+
</span>
|
1395
|
+
|
1396
|
+
— <div class='inline'>
|
1397
|
+
<p>Page url.</p>
|
1398
|
+
</div>
|
1399
|
+
|
1400
|
+
</li>
|
1401
|
+
|
1402
|
+
</ul>
|
1403
|
+
|
1404
|
+
|
1405
|
+
<p class="tag_title">Returns:</p>
|
1406
|
+
<ul class="return">
|
1407
|
+
|
1408
|
+
<li>
|
1409
|
+
|
1410
|
+
|
1411
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1412
|
+
|
1413
|
+
|
1414
|
+
|
1415
|
+
</li>
|
1416
|
+
|
1417
|
+
</ul>
|
1418
|
+
|
1419
|
+
</div><table class="source_code">
|
1420
|
+
<tr>
|
1421
|
+
<td>
|
1422
|
+
<pre class="lines">
|
1423
|
+
|
1424
|
+
|
1425
|
+
74
|
1426
|
+
75
|
1427
|
+
76
|
1428
|
+
77
|
1429
|
+
78
|
1430
|
+
79</pre>
|
1431
|
+
</td>
|
1432
|
+
<td>
|
1433
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 74</span>
|
1434
|
+
|
1435
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_build_fake_page'>build_fake_page</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1436
|
+
<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1437
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:url</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https://example.com</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1438
|
+
<span class='rbrace'>}</span>
|
1439
|
+
<span class='id identifier rubyid_build_page'>build_page</span> <span class='id identifier rubyid_page'>page</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
|
1440
|
+
<span class='kw'>end</span></pre>
|
1441
|
+
</td>
|
1442
|
+
</tr>
|
1443
|
+
</table>
|
1444
|
+
</div>
|
1445
|
+
|
1446
|
+
<div class="method_details ">
|
1447
|
+
<h3 class="signature " id="build_job-class_method">
|
1448
|
+
|
1449
|
+
.<strong>build_job</strong>(job, opts = {}) ⇒ <tt>Hash</tt>
|
1450
|
+
|
1451
|
+
|
1452
|
+
|
1453
|
+
|
1454
|
+
|
1455
|
+
</h3><div class="docstring">
|
1456
|
+
<div class="discussion">
|
1457
|
+
|
1458
|
+
<p>Build a job with defaults by using FakeDb engine.</p>
|
1459
|
+
|
1460
|
+
|
1461
|
+
</div>
|
1462
|
+
</div>
|
1463
|
+
<div class="tags">
|
1464
|
+
<p class="tag_title">Parameters:</p>
|
1465
|
+
<ul class="param">
|
1466
|
+
|
1467
|
+
<li>
|
1468
|
+
|
1469
|
+
<span class='name'>job</span>
|
1470
|
+
|
1471
|
+
|
1472
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1473
|
+
|
1474
|
+
|
1475
|
+
|
1476
|
+
—
|
1477
|
+
<div class='inline'>
|
1478
|
+
<p>Job initial values.</p>
|
1479
|
+
</div>
|
1480
|
+
|
1481
|
+
</li>
|
1482
|
+
|
1483
|
+
<li>
|
1484
|
+
|
1485
|
+
<span class='name'>opts</span>
|
1486
|
+
|
1487
|
+
|
1488
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1489
|
+
|
1490
|
+
|
1491
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1492
|
+
|
1493
|
+
|
1494
|
+
—
|
1495
|
+
<div class='inline'>
|
1496
|
+
<p>({}) Configuration options (see #initialize).</p>
|
1497
|
+
</div>
|
1498
|
+
|
1499
|
+
</li>
|
1500
|
+
|
1501
|
+
</ul>
|
1502
|
+
|
1503
|
+
<p class="tag_title">Returns:</p>
|
1504
|
+
<ul class="return">
|
1505
|
+
|
1506
|
+
<li>
|
1507
|
+
|
1508
|
+
|
1509
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1510
|
+
|
1511
|
+
|
1512
|
+
|
1513
|
+
</li>
|
1514
|
+
|
1515
|
+
</ul>
|
1516
|
+
|
1517
|
+
</div><table class="source_code">
|
1518
|
+
<tr>
|
1519
|
+
<td>
|
1520
|
+
<pre class="lines">
|
1521
|
+
|
1522
|
+
|
1523
|
+
132
|
1524
|
+
133
|
1525
|
+
134
|
1526
|
+
135
|
1527
|
+
136</pre>
|
1528
|
+
</td>
|
1529
|
+
<td>
|
1530
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 132</span>
|
1531
|
+
|
1532
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_build_job'>build_job</span> <span class='id identifier rubyid_job'>job</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1533
|
+
<span class='id identifier rubyid_temp_db'>temp_db</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Mock.html" title="DhEasy::Core::Mock (module)">Mock</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core::Mock::FakeDb (class)">FakeDb</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="DhEasy::Core::Mock::FakeDb#initialize (method)">new</a></span></span> <span class='id identifier rubyid_opts'>opts</span>
|
1534
|
+
<span class='id identifier rubyid_temp_db'>temp_db</span><span class='period'>.</span><span class='id identifier rubyid_jobs'>jobs</span> <span class='op'><<</span> <span class='id identifier rubyid_job'>job</span>
|
1535
|
+
<span class='id identifier rubyid_temp_db'>temp_db</span><span class='period'>.</span><span class='id identifier rubyid_jobs'>jobs</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
|
1536
|
+
<span class='kw'>end</span></pre>
|
1537
|
+
</td>
|
1538
|
+
</tr>
|
1539
|
+
</table>
|
1540
|
+
</div>
|
1541
|
+
|
1542
|
+
<div class="method_details ">
|
1543
|
+
<h3 class="signature " id="build_page-class_method">
|
1544
|
+
|
1545
|
+
.<strong>build_page</strong>(page, opts = {}) ⇒ <tt>Hash</tt>
|
1546
|
+
|
1547
|
+
|
1548
|
+
|
1549
|
+
|
1550
|
+
|
1551
|
+
</h3><div class="docstring">
|
1552
|
+
<div class="discussion">
|
1553
|
+
|
1554
|
+
<p>Build a page with defaults by using FakeDb engine.</p>
|
1555
|
+
|
1556
|
+
|
1557
|
+
</div>
|
1558
|
+
</div>
|
1559
|
+
<div class="tags">
|
1560
|
+
<p class="tag_title">Parameters:</p>
|
1561
|
+
<ul class="param">
|
1562
|
+
|
1563
|
+
<li>
|
1564
|
+
|
1565
|
+
<span class='name'>page</span>
|
1566
|
+
|
1567
|
+
|
1568
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1569
|
+
|
1570
|
+
|
1571
|
+
|
1572
|
+
—
|
1573
|
+
<div class='inline'>
|
1574
|
+
<p>Page initial values.</p>
|
1575
|
+
</div>
|
1576
|
+
|
1577
|
+
</li>
|
1578
|
+
|
1579
|
+
<li>
|
1580
|
+
|
1581
|
+
<span class='name'>opts</span>
|
1582
|
+
|
1583
|
+
|
1584
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1585
|
+
|
1586
|
+
|
1587
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1588
|
+
|
1589
|
+
|
1590
|
+
—
|
1591
|
+
<div class='inline'>
|
1592
|
+
<p>({}) Configuration options (see #initialize).</p>
|
1593
|
+
</div>
|
1594
|
+
|
1595
|
+
</li>
|
1596
|
+
|
1597
|
+
</ul>
|
1598
|
+
|
1599
|
+
<p class="tag_title">Returns:</p>
|
1600
|
+
<ul class="return">
|
1601
|
+
|
1602
|
+
<li>
|
1603
|
+
|
1604
|
+
|
1605
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1606
|
+
|
1607
|
+
|
1608
|
+
|
1609
|
+
</li>
|
1610
|
+
|
1611
|
+
</ul>
|
1612
|
+
|
1613
|
+
</div><table class="source_code">
|
1614
|
+
<tr>
|
1615
|
+
<td>
|
1616
|
+
<pre class="lines">
|
1617
|
+
|
1618
|
+
|
1619
|
+
58
|
1620
|
+
59
|
1621
|
+
60
|
1622
|
+
61
|
1623
|
+
62
|
1624
|
+
63
|
1625
|
+
64
|
1626
|
+
65
|
1627
|
+
66</pre>
|
1628
|
+
</td>
|
1629
|
+
<td>
|
1630
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 58</span>
|
1631
|
+
|
1632
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_build_page'>build_page</span> <span class='id identifier rubyid_page'>page</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1633
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
1634
|
+
<span class='label'>allow_page_gid_override:</span> <span class='kw'>true</span><span class='comma'>,</span>
|
1635
|
+
<span class='label'>allow_job_id_override:</span> <span class='kw'>true</span>
|
1636
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span> <span class='id identifier rubyid_opts'>opts</span>
|
1637
|
+
<span class='id identifier rubyid_temp_db'>temp_db</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Mock.html" title="DhEasy::Core::Mock (module)">Mock</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DhEasy::Core::Mock::FakeDb (class)">FakeDb</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="DhEasy::Core::Mock::FakeDb#initialize (method)">new</a></span></span> <span class='id identifier rubyid_opts'>opts</span>
|
1638
|
+
<span class='id identifier rubyid_temp_db'>temp_db</span><span class='period'>.</span><span class='id identifier rubyid_pages'>pages</span> <span class='op'><<</span> <span class='id identifier rubyid_page'>page</span>
|
1639
|
+
<span class='id identifier rubyid_temp_db'>temp_db</span><span class='period'>.</span><span class='id identifier rubyid_pages'>pages</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
1640
|
+
<span class='kw'>end</span></pre>
|
1641
|
+
</td>
|
1642
|
+
</tr>
|
1643
|
+
</table>
|
1644
|
+
</div>
|
1645
|
+
|
1646
|
+
<div class="method_details ">
|
1647
|
+
<h3 class="signature " id="clean_uri-class_method">
|
1648
|
+
|
1649
|
+
.<strong>clean_uri</strong>(raw_url) ⇒ <tt>String</tt>
|
1650
|
+
|
1651
|
+
|
1652
|
+
|
1653
|
+
|
1654
|
+
|
1655
|
+
</h3><div class="docstring">
|
1656
|
+
<div class="discussion">
|
1657
|
+
|
1658
|
+
<p>Clean an URL to remove fragment, lowercase schema and host, and sort</p>
|
1659
|
+
|
1660
|
+
<pre class="code ruby"><code class="ruby">query string.
|
1661
|
+
</code></pre>
|
1662
|
+
|
1663
|
+
|
1664
|
+
</div>
|
1665
|
+
</div>
|
1666
|
+
<div class="tags">
|
1667
|
+
<p class="tag_title">Parameters:</p>
|
1668
|
+
<ul class="param">
|
1669
|
+
|
1670
|
+
<li>
|
1671
|
+
|
1672
|
+
<span class='name'>raw_url</span>
|
1673
|
+
|
1674
|
+
|
1675
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1676
|
+
|
1677
|
+
|
1678
|
+
|
1679
|
+
—
|
1680
|
+
<div class='inline'>
|
1681
|
+
<p>URL to clean.</p>
|
1682
|
+
</div>
|
1683
|
+
|
1684
|
+
</li>
|
1685
|
+
|
1686
|
+
</ul>
|
1687
|
+
|
1688
|
+
<p class="tag_title">Returns:</p>
|
1689
|
+
<ul class="return">
|
1690
|
+
|
1691
|
+
<li>
|
1692
|
+
|
1693
|
+
|
1694
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1695
|
+
|
1696
|
+
|
1697
|
+
|
1698
|
+
</li>
|
1699
|
+
|
1700
|
+
</ul>
|
1701
|
+
|
1702
|
+
</div><table class="source_code">
|
1703
|
+
<tr>
|
1704
|
+
<td>
|
1705
|
+
<pre class="lines">
|
1706
|
+
|
1707
|
+
|
1708
|
+
87
|
1709
|
+
88
|
1710
|
+
89
|
1711
|
+
90
|
1712
|
+
91
|
1713
|
+
92
|
1714
|
+
93
|
1715
|
+
94
|
1716
|
+
95
|
1717
|
+
96
|
1718
|
+
97
|
1719
|
+
98
|
1720
|
+
99
|
1721
|
+
100
|
1722
|
+
101
|
1723
|
+
102
|
1724
|
+
103
|
1725
|
+
104
|
1726
|
+
105</pre>
|
1727
|
+
</td>
|
1728
|
+
<td>
|
1729
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 87</span>
|
1730
|
+
|
1731
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clean_uri'>clean_uri</span> <span class='id identifier rubyid_raw_url'>raw_url</span>
|
1732
|
+
<span class='id identifier rubyid_url'>url</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_raw_url'>raw_url</span><span class='rparen'>)</span>
|
1733
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_hostname'>hostname</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_hostname'>hostname</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
|
1734
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_fragment'>fragment</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1735
|
+
|
1736
|
+
<span class='comment'># Sort query string keys
|
1737
|
+
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1738
|
+
<span class='id identifier rubyid_query_string'>query_string</span> <span class='op'>=</span> <span class='const'>CGI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
1739
|
+
<span class='id identifier rubyid_keys'>keys</span> <span class='op'>=</span> <span class='id identifier rubyid_query_string'>query_string</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span>
|
1740
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1741
|
+
<span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
|
1742
|
+
<span class='id identifier rubyid_query_string'>query_string</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
1743
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span> <span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span> <span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1744
|
+
<span class='kw'>end</span>
|
1745
|
+
<span class='kw'>end</span>
|
1746
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>&</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1747
|
+
<span class='kw'>end</span>
|
1748
|
+
<span class='id identifier rubyid_url'>url</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
1749
|
+
<span class='kw'>end</span></pre>
|
1750
|
+
</td>
|
1751
|
+
</tr>
|
1752
|
+
</table>
|
1753
|
+
</div>
|
1754
|
+
|
1755
|
+
<div class="method_details ">
|
1756
|
+
<h3 class="signature " id="fake_uuid-class_method">
|
1757
|
+
|
1758
|
+
.<strong>fake_uuid</strong>(seed = nil) ⇒ <tt>String</tt>
|
1759
|
+
|
1760
|
+
|
1761
|
+
|
1762
|
+
|
1763
|
+
|
1764
|
+
</h3><div class="docstring">
|
1765
|
+
<div class="discussion">
|
1766
|
+
|
1767
|
+
<p>Generate a fake UUID.</p>
|
1768
|
+
|
1769
|
+
|
1770
|
+
</div>
|
1771
|
+
</div>
|
1772
|
+
<div class="tags">
|
1773
|
+
<p class="tag_title">Parameters:</p>
|
1774
|
+
<ul class="param">
|
1775
|
+
|
1776
|
+
<li>
|
1777
|
+
|
1778
|
+
<span class='name'>seed</span>
|
1779
|
+
|
1780
|
+
|
1781
|
+
<span class='type'>(<tt>nil</tt>)</span>
|
1782
|
+
|
1783
|
+
|
1784
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1785
|
+
|
1786
|
+
|
1787
|
+
—
|
1788
|
+
<div class='inline'>
|
1789
|
+
<p>Object to use as seed for uuid.</p>
|
1790
|
+
</div>
|
1791
|
+
|
1792
|
+
</li>
|
1793
|
+
|
1794
|
+
</ul>
|
1795
|
+
|
1796
|
+
<p class="tag_title">Returns:</p>
|
1797
|
+
<ul class="return">
|
1798
|
+
|
1799
|
+
<li>
|
1800
|
+
|
1801
|
+
|
1802
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1803
|
+
|
1804
|
+
|
1805
|
+
|
1806
|
+
</li>
|
1807
|
+
|
1808
|
+
</ul>
|
1809
|
+
|
1810
|
+
</div><table class="source_code">
|
1811
|
+
<tr>
|
1812
|
+
<td>
|
1813
|
+
<pre class="lines">
|
1814
|
+
|
1815
|
+
|
1816
|
+
37
|
1817
|
+
38
|
1818
|
+
39
|
1819
|
+
40</pre>
|
1820
|
+
</td>
|
1821
|
+
<td>
|
1822
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 37</span>
|
1823
|
+
|
1824
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_fake_uuid'>fake_uuid</span> <span class='id identifier rubyid_seed'>seed</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1825
|
+
<span class='id identifier rubyid_seed'>seed</span> <span class='op'>||=</span> <span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span> <span class='op'>+</span> <span class='id identifier rubyid_rand'>rand</span><span class='rparen'>)</span>
|
1826
|
+
<span class='const'>Digest</span><span class='op'>::</span><span class='const'>SHA1</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span> <span class='id identifier rubyid_seed'>seed</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
1827
|
+
<span class='kw'>end</span></pre>
|
1828
|
+
</td>
|
1829
|
+
</tr>
|
1830
|
+
</table>
|
1831
|
+
</div>
|
1832
|
+
|
1833
|
+
<div class="method_details ">
|
1834
|
+
<h3 class="signature " id="new_collection-class_method">
|
1835
|
+
|
1836
|
+
.<strong>new_collection</strong>(keys, opts = {}) ⇒ <tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>
|
1837
|
+
|
1838
|
+
|
1839
|
+
|
1840
|
+
|
1841
|
+
|
1842
|
+
</h3><div class="docstring">
|
1843
|
+
<div class="discussion">
|
1844
|
+
|
1845
|
+
<p>Generate a smart collection with keys and initial values.</p>
|
1846
|
+
|
1847
|
+
|
1848
|
+
</div>
|
1849
|
+
</div>
|
1850
|
+
<div class="tags">
|
1851
|
+
<p class="tag_title">Parameters:</p>
|
1852
|
+
<ul class="param">
|
1853
|
+
|
1854
|
+
<li>
|
1855
|
+
|
1856
|
+
<span class='name'>keys</span>
|
1857
|
+
|
1858
|
+
|
1859
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1860
|
+
|
1861
|
+
|
1862
|
+
|
1863
|
+
—
|
1864
|
+
<div class='inline'>
|
1865
|
+
<p>Analog to primary keys, combination will be uniq.</p>
|
1866
|
+
</div>
|
1867
|
+
|
1868
|
+
</li>
|
1869
|
+
|
1870
|
+
<li>
|
1871
|
+
|
1872
|
+
<span class='name'>opts</span>
|
1873
|
+
|
1874
|
+
|
1875
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1876
|
+
|
1877
|
+
|
1878
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1879
|
+
|
1880
|
+
|
1881
|
+
—
|
1882
|
+
<div class='inline'>
|
1883
|
+
<p>Configuration options (see DhEasy::Core::SmartCollection#initialize).</p>
|
1884
|
+
</div>
|
1885
|
+
|
1886
|
+
</li>
|
1887
|
+
|
1888
|
+
</ul>
|
1889
|
+
|
1890
|
+
<p class="tag_title">Returns:</p>
|
1891
|
+
<ul class="return">
|
1892
|
+
|
1893
|
+
<li>
|
1894
|
+
|
1895
|
+
|
1896
|
+
<span class='type'>(<tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>)</span>
|
1897
|
+
|
1898
|
+
|
1899
|
+
|
1900
|
+
</li>
|
1901
|
+
|
1902
|
+
</ul>
|
1903
|
+
|
1904
|
+
</div><table class="source_code">
|
1905
|
+
<tr>
|
1906
|
+
<td>
|
1907
|
+
<pre class="lines">
|
1908
|
+
|
1909
|
+
|
1910
|
+
28
|
1911
|
+
29
|
1912
|
+
30</pre>
|
1913
|
+
</td>
|
1914
|
+
<td>
|
1915
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 28</span>
|
1916
|
+
|
1917
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new_collection'>new_collection</span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1918
|
+
<span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">SmartCollection</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../SmartCollection.html#initialize-instance_method" title="DhEasy::Core::SmartCollection#initialize (method)">new</a></span></span> <span class='id identifier rubyid_keys'>keys</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span>
|
1919
|
+
<span class='kw'>end</span></pre>
|
1920
|
+
</td>
|
1921
|
+
</tr>
|
1922
|
+
</table>
|
1923
|
+
</div>
|
1924
|
+
|
1925
|
+
<div class="method_details ">
|
1926
|
+
<h3 class="signature " id="output_uuid-class_method">
|
1927
|
+
|
1928
|
+
.<strong>output_uuid</strong>(data) ⇒ <tt>String</tt>
|
1929
|
+
|
1930
|
+
|
1931
|
+
|
1932
|
+
|
1933
|
+
|
1934
|
+
</h3><div class="docstring">
|
1935
|
+
<div class="discussion">
|
1936
|
+
|
1937
|
+
<p>Generate a fake UUID based on output fields without `_` prefix.</p>
|
1938
|
+
|
1939
|
+
|
1940
|
+
</div>
|
1941
|
+
</div>
|
1942
|
+
<div class="tags">
|
1943
|
+
<p class="tag_title">Parameters:</p>
|
1944
|
+
<ul class="param">
|
1945
|
+
|
1946
|
+
<li>
|
1947
|
+
|
1948
|
+
<span class='name'>data</span>
|
1949
|
+
|
1950
|
+
|
1951
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
1952
|
+
|
1953
|
+
|
1954
|
+
|
1955
|
+
—
|
1956
|
+
<div class='inline'>
|
1957
|
+
<p>Output data.</p>
|
1958
|
+
</div>
|
1959
|
+
|
1960
|
+
</li>
|
1961
|
+
|
1962
|
+
</ul>
|
1963
|
+
|
1964
|
+
<p class="tag_title">Returns:</p>
|
1965
|
+
<ul class="return">
|
1966
|
+
|
1967
|
+
<li>
|
1968
|
+
|
1969
|
+
|
1970
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1971
|
+
|
1972
|
+
|
1973
|
+
|
1974
|
+
</li>
|
1975
|
+
|
1976
|
+
</ul>
|
1977
|
+
|
1978
|
+
</div><table class="source_code">
|
1979
|
+
<tr>
|
1980
|
+
<td>
|
1981
|
+
<pre class="lines">
|
1982
|
+
|
1983
|
+
|
1984
|
+
47
|
1985
|
+
48
|
1986
|
+
49
|
1987
|
+
50</pre>
|
1988
|
+
</td>
|
1989
|
+
<td>
|
1990
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 47</span>
|
1991
|
+
|
1992
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_output_uuid'>output_uuid</span> <span class='id identifier rubyid_data'>data</span>
|
1993
|
+
<span class='id identifier rubyid_seed'>seed</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[^_]</span><span class='regexp_end'>/</span></span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_hash'>hash</span>
|
1994
|
+
<span class='id identifier rubyid_fake_uuid'>fake_uuid</span> <span class='id identifier rubyid_seed'>seed</span>
|
1995
|
+
<span class='kw'>end</span></pre>
|
1996
|
+
</td>
|
1997
|
+
</tr>
|
1998
|
+
</table>
|
1999
|
+
</div>
|
2000
|
+
|
2001
|
+
<div class="method_details ">
|
2002
|
+
<h3 class="signature " id="time_stamp-class_method">
|
2003
|
+
|
2004
|
+
.<strong>time_stamp</strong>(time = nil) ⇒ <tt>String</tt>
|
2005
|
+
|
2006
|
+
|
2007
|
+
|
2008
|
+
|
2009
|
+
|
2010
|
+
</h3><div class="docstring">
|
2011
|
+
<div class="discussion">
|
2012
|
+
|
2013
|
+
<p>Return a timestamp</p>
|
2014
|
+
|
2015
|
+
|
2016
|
+
</div>
|
2017
|
+
</div>
|
2018
|
+
<div class="tags">
|
2019
|
+
<p class="tag_title">Parameters:</p>
|
2020
|
+
<ul class="param">
|
2021
|
+
|
2022
|
+
<li>
|
2023
|
+
|
2024
|
+
<span class='name'>time</span>
|
2025
|
+
|
2026
|
+
|
2027
|
+
<span class='type'>(<tt>Time</tt>)</span>
|
2028
|
+
|
2029
|
+
|
2030
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2031
|
+
|
2032
|
+
|
2033
|
+
—
|
2034
|
+
<div class='inline'>
|
2035
|
+
<p>(nil) Time from which to get time stamp.</p>
|
2036
|
+
</div>
|
2037
|
+
|
2038
|
+
</li>
|
2039
|
+
|
2040
|
+
</ul>
|
2041
|
+
|
2042
|
+
<p class="tag_title">Returns:</p>
|
2043
|
+
<ul class="return">
|
2044
|
+
|
2045
|
+
<li>
|
2046
|
+
|
2047
|
+
|
2048
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2049
|
+
|
2050
|
+
|
2051
|
+
|
2052
|
+
</li>
|
2053
|
+
|
2054
|
+
</ul>
|
2055
|
+
|
2056
|
+
</div><table class="source_code">
|
2057
|
+
<tr>
|
2058
|
+
<td>
|
2059
|
+
<pre class="lines">
|
2060
|
+
|
2061
|
+
|
2062
|
+
160
|
2063
|
+
161
|
2064
|
+
162
|
2065
|
+
163</pre>
|
2066
|
+
</td>
|
2067
|
+
<td>
|
2068
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 160</span>
|
2069
|
+
|
2070
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_time_stamp'>time_stamp</span> <span class='id identifier rubyid_time'>time</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2071
|
+
<span class='id identifier rubyid_time'>time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_time'>time</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2072
|
+
<span class='id identifier rubyid_time'>time</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%Y-%m-%dT%H:%M:%SZ</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
2073
|
+
<span class='kw'>end</span></pre>
|
2074
|
+
</td>
|
2075
|
+
</tr>
|
2076
|
+
</table>
|
2077
|
+
</div>
|
2078
|
+
|
2079
|
+
</div>
|
2080
|
+
|
2081
|
+
<div id="instance_method_details" class="method_details_list">
|
2082
|
+
<h2>Instance Method Details</h2>
|
2083
|
+
|
2084
|
+
|
2085
|
+
<div class="method_details first">
|
2086
|
+
<h3 class="signature first" id="allow_job_id_override?-instance_method">
|
2087
|
+
|
2088
|
+
#<strong>allow_job_id_override?</strong> ⇒ <tt>Boolean</tt>
|
2089
|
+
|
2090
|
+
|
2091
|
+
|
2092
|
+
|
2093
|
+
|
2094
|
+
</h3><div class="docstring">
|
2095
|
+
<div class="discussion">
|
2096
|
+
|
2097
|
+
<p>Specify whenever job id overriding by user is allowed on page or</p>
|
2098
|
+
|
2099
|
+
<pre class="code ruby"><code class="ruby">output insert.
|
2100
|
+
</code></pre>
|
2101
|
+
|
2102
|
+
|
2103
|
+
</div>
|
2104
|
+
</div>
|
2105
|
+
<div class="tags">
|
2106
|
+
|
2107
|
+
<p class="tag_title">Returns:</p>
|
2108
|
+
<ul class="return">
|
2109
|
+
|
2110
|
+
<li>
|
2111
|
+
|
2112
|
+
|
2113
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
2114
|
+
|
2115
|
+
|
2116
|
+
|
2117
|
+
—
|
2118
|
+
<div class='inline'>
|
2119
|
+
<p>`true` when allowed, else `false`.</p>
|
2120
|
+
</div>
|
2121
|
+
|
2122
|
+
</li>
|
2123
|
+
|
2124
|
+
</ul>
|
2125
|
+
|
2126
|
+
</div><table class="source_code">
|
2127
|
+
<tr>
|
2128
|
+
<td>
|
2129
|
+
<pre class="lines">
|
2130
|
+
|
2131
|
+
|
2132
|
+
252
|
2133
|
+
253
|
2134
|
+
254</pre>
|
2135
|
+
</td>
|
2136
|
+
<td>
|
2137
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 252</span>
|
2138
|
+
|
2139
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_allow_job_id_override?'>allow_job_id_override?</span>
|
2140
|
+
<span class='ivar'>@allow_job_id_override</span> <span class='op'>||=</span> <span class='kw'>false</span>
|
2141
|
+
<span class='kw'>end</span></pre>
|
2142
|
+
</td>
|
2143
|
+
</tr>
|
2144
|
+
</table>
|
2145
|
+
</div>
|
2146
|
+
|
2147
|
+
<div class="method_details ">
|
2148
|
+
<h3 class="signature " id="allow_page_gid_override?-instance_method">
|
2149
|
+
|
2150
|
+
#<strong>allow_page_gid_override?</strong> ⇒ <tt>Boolean</tt>
|
2151
|
+
|
2152
|
+
|
2153
|
+
|
2154
|
+
|
2155
|
+
|
2156
|
+
</h3><div class="docstring">
|
2157
|
+
<div class="discussion">
|
2158
|
+
|
2159
|
+
<p>Specify whenever page gid overriding by user is allowed on page or</p>
|
2160
|
+
|
2161
|
+
<pre class="code ruby"><code class="ruby">output insert.
|
2162
|
+
</code></pre>
|
2163
|
+
|
2164
|
+
|
2165
|
+
</div>
|
2166
|
+
</div>
|
2167
|
+
<div class="tags">
|
2168
|
+
|
2169
|
+
<p class="tag_title">Returns:</p>
|
2170
|
+
<ul class="return">
|
2171
|
+
|
2172
|
+
<li>
|
2173
|
+
|
2174
|
+
|
2175
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
2176
|
+
|
2177
|
+
|
2178
|
+
|
2179
|
+
—
|
2180
|
+
<div class='inline'>
|
2181
|
+
<p>`true` when allowed, else `false`.</p>
|
2182
|
+
</div>
|
2183
|
+
|
2184
|
+
</li>
|
2185
|
+
|
2186
|
+
</ul>
|
2187
|
+
|
2188
|
+
</div><table class="source_code">
|
2189
|
+
<tr>
|
2190
|
+
<td>
|
2191
|
+
<pre class="lines">
|
2192
|
+
|
2193
|
+
|
2194
|
+
234
|
2195
|
+
235
|
2196
|
+
236</pre>
|
2197
|
+
</td>
|
2198
|
+
<td>
|
2199
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 234</span>
|
2200
|
+
|
2201
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_allow_page_gid_override?'>allow_page_gid_override?</span>
|
2202
|
+
<span class='ivar'>@allow_page_gid_override</span> <span class='op'>||=</span> <span class='kw'>false</span>
|
2203
|
+
<span class='kw'>end</span></pre>
|
2204
|
+
</td>
|
2205
|
+
</tr>
|
2206
|
+
</table>
|
2207
|
+
</div>
|
2208
|
+
|
2209
|
+
<div class="method_details ">
|
2210
|
+
<h3 class="signature " id="disable_job_id_override-instance_method">
|
2211
|
+
|
2212
|
+
#<strong>disable_job_id_override</strong> ⇒ <tt>Object</tt>
|
2213
|
+
|
2214
|
+
|
2215
|
+
|
2216
|
+
|
2217
|
+
|
2218
|
+
</h3><div class="docstring">
|
2219
|
+
<div class="discussion">
|
2220
|
+
|
2221
|
+
<p>Disable job id override on page or output insert.</p>
|
2222
|
+
|
2223
|
+
|
2224
|
+
</div>
|
2225
|
+
</div>
|
2226
|
+
<div class="tags">
|
2227
|
+
|
2228
|
+
|
2229
|
+
</div><table class="source_code">
|
2230
|
+
<tr>
|
2231
|
+
<td>
|
2232
|
+
<pre class="lines">
|
2233
|
+
|
2234
|
+
|
2235
|
+
244
|
2236
|
+
245
|
2237
|
+
246</pre>
|
2238
|
+
</td>
|
2239
|
+
<td>
|
2240
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 244</span>
|
2241
|
+
|
2242
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_disable_job_id_override'>disable_job_id_override</span>
|
2243
|
+
<span class='ivar'>@allow_job_id_override</span> <span class='op'>=</span> <span class='kw'>false</span>
|
2244
|
+
<span class='kw'>end</span></pre>
|
2245
|
+
</td>
|
2246
|
+
</tr>
|
2247
|
+
</table>
|
2248
|
+
</div>
|
2249
|
+
|
2250
|
+
<div class="method_details ">
|
2251
|
+
<h3 class="signature " id="disable_page_gid_override-instance_method">
|
2252
|
+
|
2253
|
+
#<strong>disable_page_gid_override</strong> ⇒ <tt>Object</tt>
|
2254
|
+
|
2255
|
+
|
2256
|
+
|
2257
|
+
|
2258
|
+
|
2259
|
+
</h3><div class="docstring">
|
2260
|
+
<div class="discussion">
|
2261
|
+
|
2262
|
+
<p>Disable page gid override on page or output insert.</p>
|
2263
|
+
|
2264
|
+
|
2265
|
+
</div>
|
2266
|
+
</div>
|
2267
|
+
<div class="tags">
|
2268
|
+
|
2269
|
+
|
2270
|
+
</div><table class="source_code">
|
2271
|
+
<tr>
|
2272
|
+
<td>
|
2273
|
+
<pre class="lines">
|
2274
|
+
|
2275
|
+
|
2276
|
+
226
|
2277
|
+
227
|
2278
|
+
228</pre>
|
2279
|
+
</td>
|
2280
|
+
<td>
|
2281
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 226</span>
|
2282
|
+
|
2283
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_disable_page_gid_override'>disable_page_gid_override</span>
|
2284
|
+
<span class='ivar'>@allow_page_gid_override</span> <span class='op'>=</span> <span class='kw'>false</span>
|
2285
|
+
<span class='kw'>end</span></pre>
|
2286
|
+
</td>
|
2287
|
+
</tr>
|
2288
|
+
</table>
|
2289
|
+
</div>
|
2290
|
+
|
2291
|
+
<div class="method_details ">
|
2292
|
+
<h3 class="signature " id="enable_job_id_override-instance_method">
|
2293
|
+
|
2294
|
+
#<strong>enable_job_id_override</strong> ⇒ <tt>Object</tt>
|
2295
|
+
|
2296
|
+
|
2297
|
+
|
2298
|
+
|
2299
|
+
|
2300
|
+
</h3><div class="docstring">
|
2301
|
+
<div class="discussion">
|
2302
|
+
|
2303
|
+
<p>Enable job id override on page or output insert.</p>
|
2304
|
+
|
2305
|
+
|
2306
|
+
</div>
|
2307
|
+
</div>
|
2308
|
+
<div class="tags">
|
2309
|
+
|
2310
|
+
|
2311
|
+
</div><table class="source_code">
|
2312
|
+
<tr>
|
2313
|
+
<td>
|
2314
|
+
<pre class="lines">
|
2315
|
+
|
2316
|
+
|
2317
|
+
239
|
2318
|
+
240
|
2319
|
+
241</pre>
|
2320
|
+
</td>
|
2321
|
+
<td>
|
2322
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 239</span>
|
2323
|
+
|
2324
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_enable_job_id_override'>enable_job_id_override</span>
|
2325
|
+
<span class='ivar'>@allow_job_id_override</span> <span class='op'>=</span> <span class='kw'>true</span>
|
2326
|
+
<span class='kw'>end</span></pre>
|
2327
|
+
</td>
|
2328
|
+
</tr>
|
2329
|
+
</table>
|
2330
|
+
</div>
|
2331
|
+
|
2332
|
+
<div class="method_details ">
|
2333
|
+
<h3 class="signature " id="enable_page_gid_override-instance_method">
|
2334
|
+
|
2335
|
+
#<strong>enable_page_gid_override</strong> ⇒ <tt>Object</tt>
|
2336
|
+
|
2337
|
+
|
2338
|
+
|
2339
|
+
|
2340
|
+
|
2341
|
+
</h3><div class="docstring">
|
2342
|
+
<div class="discussion">
|
2343
|
+
|
2344
|
+
<p>Enable page gid override on page or output insert.</p>
|
2345
|
+
|
2346
|
+
|
2347
|
+
</div>
|
2348
|
+
</div>
|
2349
|
+
<div class="tags">
|
2350
|
+
|
2351
|
+
|
2352
|
+
</div><table class="source_code">
|
2353
|
+
<tr>
|
2354
|
+
<td>
|
2355
|
+
<pre class="lines">
|
2356
|
+
|
2357
|
+
|
2358
|
+
221
|
2359
|
+
222
|
2360
|
+
223</pre>
|
2361
|
+
</td>
|
2362
|
+
<td>
|
2363
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 221</span>
|
2364
|
+
|
2365
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_enable_page_gid_override'>enable_page_gid_override</span>
|
2366
|
+
<span class='ivar'>@allow_page_gid_override</span> <span class='op'>=</span> <span class='kw'>true</span>
|
2367
|
+
<span class='kw'>end</span></pre>
|
2368
|
+
</td>
|
2369
|
+
</tr>
|
2370
|
+
</table>
|
2371
|
+
</div>
|
2372
|
+
|
2373
|
+
<div class="method_details ">
|
2374
|
+
<h3 class="signature " id="ensure_job-instance_method">
|
2375
|
+
|
2376
|
+
#<strong>ensure_job</strong>(target_job_id = nil) ⇒ <tt>Hash</tt>
|
2377
|
+
|
2378
|
+
|
2379
|
+
|
2380
|
+
|
2381
|
+
|
2382
|
+
</h3><div class="docstring">
|
2383
|
+
<div class="discussion">
|
2384
|
+
|
2385
|
+
<p>Get current job or create new one from values.</p>
|
2386
|
+
|
2387
|
+
|
2388
|
+
</div>
|
2389
|
+
</div>
|
2390
|
+
<div class="tags">
|
2391
|
+
<p class="tag_title">Parameters:</p>
|
2392
|
+
<ul class="param">
|
2393
|
+
|
2394
|
+
<li>
|
2395
|
+
|
2396
|
+
<span class='name'>target_job_id</span>
|
2397
|
+
|
2398
|
+
|
2399
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
2400
|
+
|
2401
|
+
|
2402
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
2403
|
+
|
2404
|
+
|
2405
|
+
—
|
2406
|
+
<div class='inline'>
|
2407
|
+
<p>(nil) Job id to ensure existance.</p>
|
2408
|
+
</div>
|
2409
|
+
|
2410
|
+
</li>
|
2411
|
+
|
2412
|
+
</ul>
|
2413
|
+
|
2414
|
+
<p class="tag_title">Returns:</p>
|
2415
|
+
<ul class="return">
|
2416
|
+
|
2417
|
+
<li>
|
2418
|
+
|
2419
|
+
|
2420
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2421
|
+
|
2422
|
+
|
2423
|
+
|
2424
|
+
</li>
|
2425
|
+
|
2426
|
+
</ul>
|
2427
|
+
|
2428
|
+
</div><table class="source_code">
|
2429
|
+
<tr>
|
2430
|
+
<td>
|
2431
|
+
<pre class="lines">
|
2432
|
+
|
2433
|
+
|
2434
|
+
170
|
2435
|
+
171
|
2436
|
+
172
|
2437
|
+
173
|
2438
|
+
174
|
2439
|
+
175
|
2440
|
+
176
|
2441
|
+
177
|
2442
|
+
178
|
2443
|
+
179
|
2444
|
+
180
|
2445
|
+
181</pre>
|
2446
|
+
</td>
|
2447
|
+
<td>
|
2448
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 170</span>
|
2449
|
+
|
2450
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_ensure_job'>ensure_job</span> <span class='id identifier rubyid_target_job_id'>target_job_id</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2451
|
+
<span class='id identifier rubyid_target_job_id'>target_job_id</span> <span class='op'>=</span> <span class='id identifier rubyid_job_id'>job_id</span> <span class='kw'>if</span> <span class='id identifier rubyid_target_job_id'>target_job_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2452
|
+
<span class='id identifier rubyid_job'>job</span> <span class='op'>=</span> <span class='id identifier rubyid_jobs'>jobs</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_target_job_id'>target_job_id</span><span class='rbrace'>}</span>
|
2453
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_job'>job</span> <span class='kw'>unless</span> <span class='id identifier rubyid_job'>job</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2454
|
+
<span class='id identifier rubyid_job'>job</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
2455
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_target_job_id'>target_job_id</span><span class='comma'>,</span>
|
2456
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>scraper_name</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_scraper_name'>scraper_name</span><span class='comma'>,</span>
|
2457
|
+
<span class='rbrace'>}</span>
|
2458
|
+
<span class='id identifier rubyid_job'>job</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>status</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>active</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_target_job_id'>target_job_id</span> <span class='op'>!=</span> <span class='id identifier rubyid_job_id'>job_id</span>
|
2459
|
+
<span class='id identifier rubyid_jobs'>jobs</span> <span class='op'><<</span> <span class='id identifier rubyid_job'>job</span>
|
2460
|
+
<span class='id identifier rubyid_jobs'>jobs</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
|
2461
|
+
<span class='kw'>end</span></pre>
|
2462
|
+
</td>
|
2463
|
+
</tr>
|
2464
|
+
</table>
|
2465
|
+
</div>
|
2466
|
+
|
2467
|
+
<div class="method_details ">
|
2468
|
+
<h3 class="signature " id="generate_job_id-instance_method">
|
2469
|
+
|
2470
|
+
#<strong>generate_job_id</strong> ⇒ <tt>Integer</tt>
|
2471
|
+
|
2472
|
+
|
2473
|
+
|
2474
|
+
|
2475
|
+
|
2476
|
+
</h3><div class="docstring">
|
2477
|
+
<div class="discussion">
|
2478
|
+
|
2479
|
+
<p>Generate a fake job_id.</p>
|
2480
|
+
|
2481
|
+
|
2482
|
+
</div>
|
2483
|
+
</div>
|
2484
|
+
<div class="tags">
|
2485
|
+
|
2486
|
+
<p class="tag_title">Returns:</p>
|
2487
|
+
<ul class="return">
|
2488
|
+
|
2489
|
+
<li>
|
2490
|
+
|
2491
|
+
|
2492
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
2493
|
+
|
2494
|
+
|
2495
|
+
|
2496
|
+
</li>
|
2497
|
+
|
2498
|
+
</ul>
|
2499
|
+
|
2500
|
+
</div><table class="source_code">
|
2501
|
+
<tr>
|
2502
|
+
<td>
|
2503
|
+
<pre class="lines">
|
2504
|
+
|
2505
|
+
|
2506
|
+
284
|
2507
|
+
285
|
2508
|
+
286</pre>
|
2509
|
+
</td>
|
2510
|
+
<td>
|
2511
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 284</span>
|
2512
|
+
|
2513
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_job_id'>generate_job_id</span>
|
2514
|
+
<span class='id identifier rubyid_jobs'>jobs</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'><</span> <span class='int'>1</span> <span class='op'>?</span> <span class='int'>1</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='id identifier rubyid_jobs'>jobs</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='comma'>,</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'><=></span> <span class='id identifier rubyid_b'>b</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='int'>1</span><span class='rparen'>)</span>
|
2515
|
+
<span class='kw'>end</span></pre>
|
2516
|
+
</td>
|
2517
|
+
</tr>
|
2518
|
+
</table>
|
2519
|
+
</div>
|
2520
|
+
|
2521
|
+
<div class="method_details ">
|
2522
|
+
<h3 class="signature " id="generate_output_id-instance_method">
|
2523
|
+
|
2524
|
+
#<strong>generate_output_id</strong>(data) ⇒ <tt>String</tt>
|
2525
|
+
|
2526
|
+
|
2527
|
+
|
2528
|
+
|
2529
|
+
|
2530
|
+
</h3><div class="docstring">
|
2531
|
+
<div class="discussion">
|
2532
|
+
|
2533
|
+
<p>Generate a fake UUID for outputs.</p>
|
2534
|
+
|
2535
|
+
|
2536
|
+
</div>
|
2537
|
+
</div>
|
2538
|
+
<div class="tags">
|
2539
|
+
<p class="tag_title">Parameters:</p>
|
2540
|
+
<ul class="param">
|
2541
|
+
|
2542
|
+
<li>
|
2543
|
+
|
2544
|
+
<span class='name'>data</span>
|
2545
|
+
|
2546
|
+
|
2547
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2548
|
+
|
2549
|
+
|
2550
|
+
|
2551
|
+
—
|
2552
|
+
<div class='inline'>
|
2553
|
+
<p>Output data.</p>
|
2554
|
+
</div>
|
2555
|
+
|
2556
|
+
</li>
|
2557
|
+
|
2558
|
+
</ul>
|
2559
|
+
|
2560
|
+
<p class="tag_title">Returns:</p>
|
2561
|
+
<ul class="return">
|
2562
|
+
|
2563
|
+
<li>
|
2564
|
+
|
2565
|
+
|
2566
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2567
|
+
|
2568
|
+
|
2569
|
+
|
2570
|
+
</li>
|
2571
|
+
|
2572
|
+
</ul>
|
2573
|
+
|
2574
|
+
</div><table class="source_code">
|
2575
|
+
<tr>
|
2576
|
+
<td>
|
2577
|
+
<pre class="lines">
|
2578
|
+
|
2579
|
+
|
2580
|
+
407
|
2581
|
+
408
|
2582
|
+
409
|
2583
|
+
410</pre>
|
2584
|
+
</td>
|
2585
|
+
<td>
|
2586
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 407</span>
|
2587
|
+
|
2588
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_output_id'>generate_output_id</span> <span class='id identifier rubyid_data'>data</span>
|
2589
|
+
<span class='comment'># Generate random UUID to match Datahen behavior
|
2590
|
+
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_fake_uuid'>fake_uuid</span>
|
2591
|
+
<span class='kw'>end</span></pre>
|
2592
|
+
</td>
|
2593
|
+
</tr>
|
2594
|
+
</table>
|
2595
|
+
</div>
|
2596
|
+
|
2597
|
+
<div class="method_details ">
|
2598
|
+
<h3 class="signature " id="generate_page_gid-instance_method">
|
2599
|
+
|
2600
|
+
#<strong>generate_page_gid</strong>(page_data) ⇒ <tt>String</tt>
|
2601
|
+
|
2602
|
+
|
2603
|
+
|
2604
|
+
|
2605
|
+
|
2606
|
+
</h3><div class="docstring">
|
2607
|
+
<div class="discussion">
|
2608
|
+
|
2609
|
+
<p>Generate a fake UUID based on page data:</p>
|
2610
|
+
|
2611
|
+
<pre class="code ruby"><code class="ruby">* url
|
2612
|
+
* method
|
2613
|
+
* headers
|
2614
|
+
* fetch_type
|
2615
|
+
* cookie
|
2616
|
+
* no_redirect
|
2617
|
+
* body
|
2618
|
+
* ua_type
|
2619
|
+
</code></pre>
|
2620
|
+
|
2621
|
+
|
2622
|
+
</div>
|
2623
|
+
</div>
|
2624
|
+
<div class="tags">
|
2625
|
+
<p class="tag_title">Parameters:</p>
|
2626
|
+
<ul class="param">
|
2627
|
+
|
2628
|
+
<li>
|
2629
|
+
|
2630
|
+
<span class='name'>page_data</span>
|
2631
|
+
|
2632
|
+
|
2633
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
2634
|
+
|
2635
|
+
|
2636
|
+
|
2637
|
+
—
|
2638
|
+
<div class='inline'>
|
2639
|
+
<p>Page data.</p>
|
2640
|
+
</div>
|
2641
|
+
|
2642
|
+
</li>
|
2643
|
+
|
2644
|
+
</ul>
|
2645
|
+
|
2646
|
+
<p class="tag_title">Returns:</p>
|
2647
|
+
<ul class="return">
|
2648
|
+
|
2649
|
+
<li>
|
2650
|
+
|
2651
|
+
|
2652
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2653
|
+
|
2654
|
+
|
2655
|
+
|
2656
|
+
</li>
|
2657
|
+
|
2658
|
+
</ul>
|
2659
|
+
|
2660
|
+
</div><table class="source_code">
|
2661
|
+
<tr>
|
2662
|
+
<td>
|
2663
|
+
<pre class="lines">
|
2664
|
+
|
2665
|
+
|
2666
|
+
331
|
2667
|
+
332
|
2668
|
+
333
|
2669
|
+
334
|
2670
|
+
335
|
2671
|
+
336
|
2672
|
+
337
|
2673
|
+
338
|
2674
|
+
339
|
2675
|
+
340
|
2676
|
+
341
|
2677
|
+
342
|
2678
|
+
343
|
2679
|
+
344
|
2680
|
+
345
|
2681
|
+
346
|
2682
|
+
347
|
2683
|
+
348
|
2684
|
+
349</pre>
|
2685
|
+
</td>
|
2686
|
+
<td>
|
2687
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 331</span>
|
2688
|
+
|
2689
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_page_gid'>generate_page_gid</span> <span class='id identifier rubyid_page_data'>page_data</span>
|
2690
|
+
<span class='id identifier rubyid_fields'>fields</span> <span class='op'>=</span> <span class='lbracket'>[</span>
|
2691
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2692
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>method</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2693
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>headers</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2694
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fetch_type</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2695
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cookie</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2696
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>no_redirect</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2697
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>body</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
2698
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ua_type</span><span class='tstring_end'>'</span></span>
|
2699
|
+
<span class='rbracket'>]</span>
|
2700
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_page_data'>page_data</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span><span class='id identifier rubyid_fields'>fields</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_k'>k</span><span class='rbrace'>}</span>
|
2701
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_clean_uri'>clean_uri</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
2702
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>headers</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_format_headers'>format_headers</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>headers</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
2703
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Helper.html" title="DhEasy::Core::Helper (module)">Helper</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Helper/Cookie.html" title="DhEasy::Core::Helper::Cookie (class)">Cookie</a></span></span><span class='period'>.</span><span class='id identifier rubyid_parse_from_request'><span class='object_link'><a href="../Helper/Cookie.html#parse_from_request-class_method" title="DhEasy::Core::Helper::Cookie.parse_from_request (method)">parse_from_request</a></span></span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2704
|
+
<span class='id identifier rubyid_seed'>seed</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span><span class='id identifier rubyid_fields'>fields</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_k'>k</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_hash'>hash</span>
|
2705
|
+
<span class='id identifier rubyid_checksum'>checksum</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_fake_uuid'>fake_uuid</span> <span class='id identifier rubyid_seed'>seed</span>
|
2706
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_hostname'>hostname</span><span class='embexpr_end'>}</span><span class='tstring_content'>-</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_checksum'>checksum</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
2707
|
+
<span class='kw'>end</span></pre>
|
2708
|
+
</td>
|
2709
|
+
</tr>
|
2710
|
+
</table>
|
2711
|
+
</div>
|
2712
|
+
|
2713
|
+
<div class="method_details ">
|
2714
|
+
<h3 class="signature " id="generate_scraper_name-instance_method">
|
2715
|
+
|
2716
|
+
#<strong>generate_scraper_name</strong> ⇒ <tt>String</tt>
|
2717
|
+
|
2718
|
+
|
2719
|
+
|
2720
|
+
|
2721
|
+
|
2722
|
+
</h3><div class="docstring">
|
2723
|
+
<div class="discussion">
|
2724
|
+
|
2725
|
+
<p>Generate a fake scraper name.</p>
|
2726
|
+
|
2727
|
+
|
2728
|
+
</div>
|
2729
|
+
</div>
|
2730
|
+
<div class="tags">
|
2731
|
+
|
2732
|
+
<p class="tag_title">Returns:</p>
|
2733
|
+
<ul class="return">
|
2734
|
+
|
2735
|
+
<li>
|
2736
|
+
|
2737
|
+
|
2738
|
+
<span class='type'>(<tt>String</tt>)</span>
|
2739
|
+
|
2740
|
+
|
2741
|
+
|
2742
|
+
</li>
|
2743
|
+
|
2744
|
+
</ul>
|
2745
|
+
|
2746
|
+
</div><table class="source_code">
|
2747
|
+
<tr>
|
2748
|
+
<td>
|
2749
|
+
<pre class="lines">
|
2750
|
+
|
2751
|
+
|
2752
|
+
277
|
2753
|
+
278
|
2754
|
+
279</pre>
|
2755
|
+
</td>
|
2756
|
+
<td>
|
2757
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 277</span>
|
2758
|
+
|
2759
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_scraper_name'>generate_scraper_name</span>
|
2760
|
+
<span class='const'>Faker</span><span class='op'>::</span><span class='const'>Internet</span><span class='period'>.</span><span class='id identifier rubyid_unique'>unique</span><span class='period'>.</span><span class='id identifier rubyid_slug'>slug</span>
|
2761
|
+
<span class='kw'>end</span></pre>
|
2762
|
+
</td>
|
2763
|
+
</tr>
|
2764
|
+
</table>
|
2765
|
+
</div>
|
2766
|
+
|
2767
|
+
<div class="method_details ">
|
2768
|
+
<h3 class="signature " id="job_id-instance_method">
|
2769
|
+
|
2770
|
+
#<strong>job_id</strong> ⇒ <tt>Integer</tt><sup>?</sup>
|
2771
|
+
|
2772
|
+
|
2773
|
+
|
2774
|
+
|
2775
|
+
|
2776
|
+
</h3><div class="docstring">
|
2777
|
+
<div class="discussion">
|
2778
|
+
|
2779
|
+
<p>Fake job id.</p>
|
2780
|
+
|
2781
|
+
|
2782
|
+
</div>
|
2783
|
+
</div>
|
2784
|
+
<div class="tags">
|
2785
|
+
|
2786
|
+
<p class="tag_title">Returns:</p>
|
2787
|
+
<ul class="return">
|
2788
|
+
|
2789
|
+
<li>
|
2790
|
+
|
2791
|
+
|
2792
|
+
<span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
|
2793
|
+
|
2794
|
+
|
2795
|
+
|
2796
|
+
</li>
|
2797
|
+
|
2798
|
+
</ul>
|
2799
|
+
|
2800
|
+
</div><table class="source_code">
|
2801
|
+
<tr>
|
2802
|
+
<td>
|
2803
|
+
<pre class="lines">
|
2804
|
+
|
2805
|
+
|
2806
|
+
198
|
2807
|
+
199
|
2808
|
+
200</pre>
|
2809
|
+
</td>
|
2810
|
+
<td>
|
2811
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 198</span>
|
2812
|
+
|
2813
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_job_id'>job_id</span>
|
2814
|
+
<span class='ivar'>@job_id</span> <span class='op'>||=</span> <span class='id identifier rubyid_generate_job_id'>generate_job_id</span>
|
2815
|
+
<span class='kw'>end</span></pre>
|
2816
|
+
</td>
|
2817
|
+
</tr>
|
2818
|
+
</table>
|
2819
|
+
</div>
|
2820
|
+
|
2821
|
+
<div class="method_details ">
|
2822
|
+
<h3 class="signature " id="job_id=-instance_method">
|
2823
|
+
|
2824
|
+
#<strong>job_id=</strong>(value) ⇒ <tt>Object</tt>
|
2825
|
+
|
2826
|
+
|
2827
|
+
|
2828
|
+
|
2829
|
+
|
2830
|
+
</h3><div class="docstring">
|
2831
|
+
<div class="discussion">
|
2832
|
+
|
2833
|
+
<p>Set fake job id value.</p>
|
2834
|
+
|
2835
|
+
|
2836
|
+
</div>
|
2837
|
+
</div>
|
2838
|
+
<div class="tags">
|
2839
|
+
|
2840
|
+
|
2841
|
+
</div><table class="source_code">
|
2842
|
+
<tr>
|
2843
|
+
<td>
|
2844
|
+
<pre class="lines">
|
2845
|
+
|
2846
|
+
|
2847
|
+
203
|
2848
|
+
204
|
2849
|
+
205
|
2850
|
+
206
|
2851
|
+
207</pre>
|
2852
|
+
</td>
|
2853
|
+
<td>
|
2854
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 203</span>
|
2855
|
+
|
2856
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_job_id='>job_id=</span> <span class='id identifier rubyid_value'>value</span>
|
2857
|
+
<span class='ivar'>@job_id</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
2858
|
+
<span class='id identifier rubyid_ensure_job'>ensure_job</span>
|
2859
|
+
<span class='id identifier rubyid_job_id'>job_id</span>
|
2860
|
+
<span class='kw'>end</span></pre>
|
2861
|
+
</td>
|
2862
|
+
</tr>
|
2863
|
+
</table>
|
2864
|
+
</div>
|
2865
|
+
|
2866
|
+
<div class="method_details ">
|
2867
|
+
<h3 class="signature " id="jobs-instance_method">
|
2868
|
+
|
2869
|
+
#<strong>jobs</strong> ⇒ <tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>
|
2870
|
+
|
2871
|
+
|
2872
|
+
|
2873
|
+
|
2874
|
+
|
2875
|
+
</h3><div class="docstring">
|
2876
|
+
<div class="discussion">
|
2877
|
+
|
2878
|
+
<p>Stored job collection</p>
|
2879
|
+
|
2880
|
+
|
2881
|
+
</div>
|
2882
|
+
</div>
|
2883
|
+
<div class="tags">
|
2884
|
+
|
2885
|
+
<p class="tag_title">Returns:</p>
|
2886
|
+
<ul class="return">
|
2887
|
+
|
2888
|
+
<li>
|
2889
|
+
|
2890
|
+
|
2891
|
+
<span class='type'>(<tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>)</span>
|
2892
|
+
|
2893
|
+
|
2894
|
+
|
2895
|
+
</li>
|
2896
|
+
|
2897
|
+
</ul>
|
2898
|
+
|
2899
|
+
</div><table class="source_code">
|
2900
|
+
<tr>
|
2901
|
+
<td>
|
2902
|
+
<pre class="lines">
|
2903
|
+
|
2904
|
+
|
2905
|
+
304
|
2906
|
+
305
|
2907
|
+
306
|
2908
|
+
307
|
2909
|
+
308
|
2910
|
+
309
|
2911
|
+
310
|
2912
|
+
311
|
2913
|
+
312
|
2914
|
+
313
|
2915
|
+
314
|
2916
|
+
315
|
2917
|
+
316</pre>
|
2918
|
+
</td>
|
2919
|
+
<td>
|
2920
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 304</span>
|
2921
|
+
|
2922
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_jobs'>jobs</span>
|
2923
|
+
<span class='kw'>return</span> <span class='ivar'>@jobs</span> <span class='kw'>unless</span> <span class='ivar'>@jobs</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2924
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new_collection'>new_collection</span> <span class='const'><span class='object_link'><a href="#JOB_KEYS-constant" title="DhEasy::Core::Mock::FakeDb::JOB_KEYS (constant)">JOB_KEYS</a></span></span><span class='comma'>,</span>
|
2925
|
+
<span class='label'>defaults:</span> <span class='id identifier rubyid_job_defaults'>job_defaults</span>
|
2926
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:before_defaults</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_raw_item'>raw_item</span><span class='op'>|</span>
|
2927
|
+
<span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_deep_stringify_keys'><span class='object_link'><a href="../../Core.html#deep_stringify_keys-class_method" title="DhEasy::Core.deep_stringify_keys (method)">deep_stringify_keys</a></span></span> <span class='id identifier rubyid_raw_item'>raw_item</span>
|
2928
|
+
<span class='kw'>end</span>
|
2929
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:before_insert</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_match'>match</span><span class='op'>|</span>
|
2930
|
+
<span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_generate_job_id'>generate_job_id</span>
|
2931
|
+
<span class='id identifier rubyid_item'>item</span>
|
2932
|
+
<span class='kw'>end</span>
|
2933
|
+
<span class='ivar'>@jobs</span> <span class='op'>||=</span> <span class='id identifier rubyid_collection'>collection</span>
|
2934
|
+
<span class='kw'>end</span></pre>
|
2935
|
+
</td>
|
2936
|
+
</tr>
|
2937
|
+
</table>
|
2938
|
+
</div>
|
2939
|
+
|
2940
|
+
<div class="method_details ">
|
2941
|
+
<h3 class="signature " id="outputs-instance_method">
|
2942
|
+
|
2943
|
+
#<strong>outputs</strong> ⇒ <tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>
|
2944
|
+
|
2945
|
+
|
2946
|
+
|
2947
|
+
|
2948
|
+
|
2949
|
+
</h3><div class="docstring">
|
2950
|
+
<div class="discussion">
|
2951
|
+
|
2952
|
+
<p>Stored output collection</p>
|
2953
|
+
|
2954
|
+
|
2955
|
+
</div>
|
2956
|
+
</div>
|
2957
|
+
<div class="tags">
|
2958
|
+
|
2959
|
+
<p class="tag_title">Returns:</p>
|
2960
|
+
<ul class="return">
|
2961
|
+
|
2962
|
+
<li>
|
2963
|
+
|
2964
|
+
|
2965
|
+
<span class='type'>(<tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>)</span>
|
2966
|
+
|
2967
|
+
|
2968
|
+
|
2969
|
+
</li>
|
2970
|
+
|
2971
|
+
</ul>
|
2972
|
+
|
2973
|
+
</div><table class="source_code">
|
2974
|
+
<tr>
|
2975
|
+
<td>
|
2976
|
+
<pre class="lines">
|
2977
|
+
|
2978
|
+
|
2979
|
+
428
|
2980
|
+
429
|
2981
|
+
430
|
2982
|
+
431
|
2983
|
+
432
|
2984
|
+
433
|
2985
|
+
434
|
2986
|
+
435
|
2987
|
+
436
|
2988
|
+
437
|
2989
|
+
438
|
2990
|
+
439
|
2991
|
+
440
|
2992
|
+
441
|
2993
|
+
442
|
2994
|
+
443
|
2995
|
+
444
|
2996
|
+
445
|
2997
|
+
446</pre>
|
2998
|
+
</td>
|
2999
|
+
<td>
|
3000
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 428</span>
|
3001
|
+
|
3002
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_outputs'>outputs</span>
|
3003
|
+
<span class='kw'>return</span> <span class='ivar'>@outputs</span> <span class='kw'>unless</span> <span class='ivar'>@outputs</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
3004
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new_collection'>new_collection</span> <span class='const'><span class='object_link'><a href="#OUTPUT_KEYS-constant" title="DhEasy::Core::Mock::FakeDb::OUTPUT_KEYS (constant)">OUTPUT_KEYS</a></span></span><span class='comma'>,</span>
|
3005
|
+
<span class='label'>defaults:</span> <span class='id identifier rubyid_output_defaults'>output_defaults</span>
|
3006
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:before_defaults</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_raw_item'>raw_item</span><span class='op'>|</span>
|
3007
|
+
<span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_deep_stringify_keys'><span class='object_link'><a href="../../Core.html#deep_stringify_keys-class_method" title="DhEasy::Core.deep_stringify_keys (method)">deep_stringify_keys</a></span></span> <span class='id identifier rubyid_raw_item'>raw_item</span>
|
3008
|
+
<span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_job_id</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_allow_job_id_override?'>allow_job_id_override?</span>
|
3009
|
+
<span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_gid_id</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_allow_page_gid_override?'>allow_page_gid_override?</span>
|
3010
|
+
<span class='id identifier rubyid_item'>item</span>
|
3011
|
+
<span class='kw'>end</span>
|
3012
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:before_insert</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_match'>match</span><span class='op'>|</span>
|
3013
|
+
<span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_generate_output_id'>generate_output_id</span> <span class='id identifier rubyid_item'>item</span>
|
3014
|
+
<span class='id identifier rubyid_item'>item</span>
|
3015
|
+
<span class='kw'>end</span>
|
3016
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:after_insert</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
|
3017
|
+
<span class='id identifier rubyid_ensure_job'>ensure_job</span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
3018
|
+
<span class='kw'>end</span>
|
3019
|
+
<span class='ivar'>@outputs</span> <span class='op'>||=</span> <span class='id identifier rubyid_collection'>collection</span>
|
3020
|
+
<span class='kw'>end</span></pre>
|
3021
|
+
</td>
|
3022
|
+
</tr>
|
3023
|
+
</table>
|
3024
|
+
</div>
|
3025
|
+
|
3026
|
+
<div class="method_details ">
|
3027
|
+
<h3 class="signature " id="page_gid-instance_method">
|
3028
|
+
|
3029
|
+
#<strong>page_gid</strong> ⇒ <tt>Integer</tt><sup>?</sup>
|
3030
|
+
|
3031
|
+
|
3032
|
+
|
3033
|
+
|
3034
|
+
|
3035
|
+
</h3><div class="docstring">
|
3036
|
+
<div class="discussion">
|
3037
|
+
|
3038
|
+
<p>Current fake page gid.</p>
|
3039
|
+
|
3040
|
+
|
3041
|
+
</div>
|
3042
|
+
</div>
|
3043
|
+
<div class="tags">
|
3044
|
+
|
3045
|
+
<p class="tag_title">Returns:</p>
|
3046
|
+
<ul class="return">
|
3047
|
+
|
3048
|
+
<li>
|
3049
|
+
|
3050
|
+
|
3051
|
+
<span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
|
3052
|
+
|
3053
|
+
|
3054
|
+
|
3055
|
+
</li>
|
3056
|
+
|
3057
|
+
</ul>
|
3058
|
+
|
3059
|
+
</div><table class="source_code">
|
3060
|
+
<tr>
|
3061
|
+
<td>
|
3062
|
+
<pre class="lines">
|
3063
|
+
|
3064
|
+
|
3065
|
+
211
|
3066
|
+
212
|
3067
|
+
213</pre>
|
3068
|
+
</td>
|
3069
|
+
<td>
|
3070
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 211</span>
|
3071
|
+
|
3072
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_page_gid'>page_gid</span>
|
3073
|
+
<span class='ivar'>@page_gid</span> <span class='op'>||=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_fake_uuid'>fake_uuid</span>
|
3074
|
+
<span class='kw'>end</span></pre>
|
3075
|
+
</td>
|
3076
|
+
</tr>
|
3077
|
+
</table>
|
3078
|
+
</div>
|
3079
|
+
|
3080
|
+
<div class="method_details ">
|
3081
|
+
<h3 class="signature " id="page_gid=-instance_method">
|
3082
|
+
|
3083
|
+
#<strong>page_gid=</strong>(value) ⇒ <tt>Object</tt>
|
3084
|
+
|
3085
|
+
|
3086
|
+
|
3087
|
+
|
3088
|
+
|
3089
|
+
</h3><div class="docstring">
|
3090
|
+
<div class="discussion">
|
3091
|
+
|
3092
|
+
<p>Set current fake page gid value.</p>
|
3093
|
+
|
3094
|
+
|
3095
|
+
</div>
|
3096
|
+
</div>
|
3097
|
+
<div class="tags">
|
3098
|
+
|
3099
|
+
|
3100
|
+
</div><table class="source_code">
|
3101
|
+
<tr>
|
3102
|
+
<td>
|
3103
|
+
<pre class="lines">
|
3104
|
+
|
3105
|
+
|
3106
|
+
216
|
3107
|
+
217
|
3108
|
+
218</pre>
|
3109
|
+
</td>
|
3110
|
+
<td>
|
3111
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 216</span>
|
3112
|
+
|
3113
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_page_gid='>page_gid=</span> <span class='id identifier rubyid_value'>value</span>
|
3114
|
+
<span class='ivar'>@page_gid</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
3115
|
+
<span class='kw'>end</span></pre>
|
3116
|
+
</td>
|
3117
|
+
</tr>
|
3118
|
+
</table>
|
3119
|
+
</div>
|
3120
|
+
|
3121
|
+
<div class="method_details ">
|
3122
|
+
<h3 class="signature " id="pages-instance_method">
|
3123
|
+
|
3124
|
+
#<strong>pages</strong> ⇒ <tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>
|
3125
|
+
|
3126
|
+
|
3127
|
+
|
3128
|
+
|
3129
|
+
|
3130
|
+
</h3><div class="docstring">
|
3131
|
+
<div class="discussion">
|
3132
|
+
|
3133
|
+
<div class="note notetag">
|
3134
|
+
<strong>Note:</strong>
|
3135
|
+
<div class='inline'>
|
3136
|
+
<p>Page gid will be replaced on insert by an auto generated uuid unless page
|
3137
|
+
gid overriding is enabled (see #allow_page_gid_override?)</p>
|
3138
|
+
</div>
|
3139
|
+
</div>
|
3140
|
+
|
3141
|
+
|
3142
|
+
<p>Stored page collection.</p>
|
3143
|
+
|
3144
|
+
|
3145
|
+
</div>
|
3146
|
+
</div>
|
3147
|
+
<div class="tags">
|
3148
|
+
|
3149
|
+
<p class="tag_title">Returns:</p>
|
3150
|
+
<ul class="return">
|
3151
|
+
|
3152
|
+
<li>
|
3153
|
+
|
3154
|
+
|
3155
|
+
<span class='type'>(<tt><span class='object_link'><a href="../SmartCollection.html" title="DhEasy::Core::SmartCollection (class)">DhEasy::Core::SmartCollection</a></span></tt>)</span>
|
3156
|
+
|
3157
|
+
|
3158
|
+
|
3159
|
+
</li>
|
3160
|
+
|
3161
|
+
</ul>
|
3162
|
+
|
3163
|
+
</div><table class="source_code">
|
3164
|
+
<tr>
|
3165
|
+
<td>
|
3166
|
+
<pre class="lines">
|
3167
|
+
|
3168
|
+
|
3169
|
+
380
|
3170
|
+
381
|
3171
|
+
382
|
3172
|
+
383
|
3173
|
+
384
|
3174
|
+
385
|
3175
|
+
386
|
3176
|
+
387
|
3177
|
+
388
|
3178
|
+
389
|
3179
|
+
390
|
3180
|
+
391
|
3181
|
+
392
|
3182
|
+
393
|
3183
|
+
394
|
3184
|
+
395
|
3185
|
+
396
|
3186
|
+
397
|
3187
|
+
398
|
3188
|
+
399
|
3189
|
+
400</pre>
|
3190
|
+
</td>
|
3191
|
+
<td>
|
3192
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 380</span>
|
3193
|
+
|
3194
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_pages'>pages</span>
|
3195
|
+
<span class='kw'>return</span> <span class='ivar'>@pages</span> <span class='kw'>unless</span> <span class='ivar'>@page</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
3196
|
+
|
3197
|
+
<span class='id identifier rubyid_collection'>collection</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_new_collection'>new_collection</span> <span class='const'><span class='object_link'><a href="#PAGE_KEYS-constant" title="DhEasy::Core::Mock::FakeDb::PAGE_KEYS (constant)">PAGE_KEYS</a></span></span><span class='comma'>,</span>
|
3198
|
+
<span class='label'>defaults:</span> <span class='id identifier rubyid_page_defaults'>page_defaults</span>
|
3199
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:before_defaults</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_raw_item'>raw_item</span><span class='op'>|</span>
|
3200
|
+
<span class='id identifier rubyid_item'>item</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../../DhEasy.html" title="DhEasy (module)">DhEasy</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Core.html" title="DhEasy::Core (module)">Core</a></span></span><span class='period'>.</span><span class='id identifier rubyid_deep_stringify_keys'><span class='object_link'><a href="../../Core.html#deep_stringify_keys-class_method" title="DhEasy::Core.deep_stringify_keys (method)">deep_stringify_keys</a></span></span> <span class='id identifier rubyid_raw_item'>raw_item</span>
|
3201
|
+
<span class='id identifier rubyid_item'>item</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_allow_job_id_override?'>allow_job_id_override?</span>
|
3202
|
+
<span class='id identifier rubyid_item'>item</span>
|
3203
|
+
<span class='kw'>end</span>
|
3204
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:before_insert</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_match'>match</span><span class='op'>|</span>
|
3205
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gid</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_allow_page_gid_override?'>allow_page_gid_override?</span>
|
3206
|
+
<span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gid</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_page_gid'>generate_page_gid</span> <span class='id identifier rubyid_item'>item</span>
|
3207
|
+
<span class='kw'>end</span>
|
3208
|
+
<span class='id identifier rubyid_item'>item</span>
|
3209
|
+
<span class='kw'>end</span>
|
3210
|
+
<span class='id identifier rubyid_collection'>collection</span><span class='period'>.</span><span class='id identifier rubyid_bind_event'>bind_event</span><span class='lparen'>(</span><span class='symbol'>:after_insert</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
|
3211
|
+
<span class='id identifier rubyid_ensure_job'>ensure_job</span> <span class='id identifier rubyid_item'>item</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
3212
|
+
<span class='kw'>end</span>
|
3213
|
+
<span class='ivar'>@pages</span> <span class='op'>||=</span> <span class='id identifier rubyid_collection'>collection</span>
|
3214
|
+
<span class='kw'>end</span></pre>
|
3215
|
+
</td>
|
3216
|
+
</tr>
|
3217
|
+
</table>
|
3218
|
+
</div>
|
3219
|
+
|
3220
|
+
<div class="method_details ">
|
3221
|
+
<h3 class="signature " id="query-instance_method">
|
3222
|
+
|
3223
|
+
#<strong>query</strong>(collection, filter, offset = 0, limit = nil) ⇒ <tt>Object</tt>
|
3224
|
+
|
3225
|
+
|
3226
|
+
|
3227
|
+
|
3228
|
+
|
3229
|
+
</h3><div class="docstring">
|
3230
|
+
<div class="discussion">
|
3231
|
+
|
3232
|
+
<div class="note notetag">
|
3233
|
+
<strong>Note:</strong>
|
3234
|
+
<div class='inline'>
|
3235
|
+
<p><em>Warning:</em> It uses table scan to filter and should be used on test
|
3236
|
+
suites only.</p>
|
3237
|
+
</div>
|
3238
|
+
</div>
|
3239
|
+
|
3240
|
+
|
3241
|
+
<p>Search items from a collection.</p>
|
3242
|
+
|
3243
|
+
|
3244
|
+
</div>
|
3245
|
+
</div>
|
3246
|
+
<div class="tags">
|
3247
|
+
<p class="tag_title">Parameters:</p>
|
3248
|
+
<ul class="param">
|
3249
|
+
|
3250
|
+
<li>
|
3251
|
+
|
3252
|
+
<span class='name'>collection</span>
|
3253
|
+
|
3254
|
+
|
3255
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
3256
|
+
|
3257
|
+
|
3258
|
+
|
3259
|
+
—
|
3260
|
+
<div class='inline'>
|
3261
|
+
<p>Allowed values: `:outputs`, `:pages`.</p>
|
3262
|
+
</div>
|
3263
|
+
|
3264
|
+
</li>
|
3265
|
+
|
3266
|
+
<li>
|
3267
|
+
|
3268
|
+
<span class='name'>filter</span>
|
3269
|
+
|
3270
|
+
|
3271
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
3272
|
+
|
3273
|
+
|
3274
|
+
|
3275
|
+
—
|
3276
|
+
<div class='inline'>
|
3277
|
+
<p>Filters to query.</p>
|
3278
|
+
</div>
|
3279
|
+
|
3280
|
+
</li>
|
3281
|
+
|
3282
|
+
<li>
|
3283
|
+
|
3284
|
+
<span class='name'>offset</span>
|
3285
|
+
|
3286
|
+
|
3287
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
3288
|
+
|
3289
|
+
|
3290
|
+
<em class="default">(defaults to: <tt>0</tt>)</em>
|
3291
|
+
|
3292
|
+
|
3293
|
+
—
|
3294
|
+
<div class='inline'>
|
3295
|
+
<p>(0) Search results offset.</p>
|
3296
|
+
</div>
|
3297
|
+
|
3298
|
+
</li>
|
3299
|
+
|
3300
|
+
<li>
|
3301
|
+
|
3302
|
+
<span class='name'>limit</span>
|
3303
|
+
|
3304
|
+
|
3305
|
+
<span class='type'>(<tt>Integer</tt>, <tt>nil</tt>)</span>
|
3306
|
+
|
3307
|
+
|
3308
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
3309
|
+
|
3310
|
+
|
3311
|
+
—
|
3312
|
+
<div class='inline'>
|
3313
|
+
<p>(nil) Limit search results count. Set to `nil` for unlimited.</p>
|
3314
|
+
</div>
|
3315
|
+
|
3316
|
+
</li>
|
3317
|
+
|
3318
|
+
</ul>
|
3319
|
+
|
3320
|
+
<p class="tag_title">Raises:</p>
|
3321
|
+
<ul class="raise">
|
3322
|
+
|
3323
|
+
<li>
|
3324
|
+
|
3325
|
+
|
3326
|
+
<span class='type'></span>
|
3327
|
+
|
3328
|
+
|
3329
|
+
|
3330
|
+
|
3331
|
+
<div class='inline'>
|
3332
|
+
<p>ArgumentError On unknown collection.</p>
|
3333
|
+
</div>
|
3334
|
+
|
3335
|
+
</li>
|
3336
|
+
|
3337
|
+
</ul>
|
3338
|
+
|
3339
|
+
</div><table class="source_code">
|
3340
|
+
<tr>
|
3341
|
+
<td>
|
3342
|
+
<pre class="lines">
|
3343
|
+
|
3344
|
+
|
3345
|
+
475
|
3346
|
+
476
|
3347
|
+
477
|
3348
|
+
478
|
3349
|
+
479
|
3350
|
+
480
|
3351
|
+
481
|
3352
|
+
482
|
3353
|
+
483
|
3354
|
+
484
|
3355
|
+
485
|
3356
|
+
486
|
3357
|
+
487
|
3358
|
+
488
|
3359
|
+
489
|
3360
|
+
490
|
3361
|
+
491
|
3362
|
+
492
|
3363
|
+
493
|
3364
|
+
494
|
3365
|
+
495
|
3366
|
+
496
|
3367
|
+
497
|
3368
|
+
498
|
3369
|
+
499
|
3370
|
+
500
|
3371
|
+
501
|
3372
|
+
502
|
3373
|
+
503
|
3374
|
+
504</pre>
|
3375
|
+
</td>
|
3376
|
+
<td>
|
3377
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 475</span>
|
3378
|
+
|
3379
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_query'>query</span> <span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_filter'>filter</span><span class='comma'>,</span> <span class='id identifier rubyid_offset'>offset</span> <span class='op'>=</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_limit'>limit</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3380
|
+
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_limit'>limit</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_limit'>limit</span> <span class='op'>></span> <span class='int'>0</span>
|
3381
|
+
|
3382
|
+
<span class='comment'># Get collection items
|
3383
|
+
</span> <span class='id identifier rubyid_items'>items</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_collection'>collection</span>
|
3384
|
+
<span class='kw'>when</span> <span class='symbol'>:outputs</span>
|
3385
|
+
<span class='id identifier rubyid_outputs'>outputs</span>
|
3386
|
+
<span class='kw'>when</span> <span class='symbol'>:pages</span>
|
3387
|
+
<span class='id identifier rubyid_pages'>pages</span>
|
3388
|
+
<span class='kw'>when</span> <span class='symbol'>:jobs</span>
|
3389
|
+
<span class='id identifier rubyid_jobs'>jobs</span>
|
3390
|
+
<span class='kw'>else</span>
|
3391
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unknown collection </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_collection'>collection</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
3392
|
+
<span class='kw'>end</span>
|
3393
|
+
|
3394
|
+
<span class='comment'># Search items
|
3395
|
+
</span> <span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='int'>0</span>
|
3396
|
+
<span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
3397
|
+
<span class='id identifier rubyid_items'>items</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item'>item</span><span class='op'>|</span>
|
3398
|
+
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_match?'>match?</span> <span class='id identifier rubyid_item'>item</span><span class='comma'>,</span> <span class='id identifier rubyid_filter'>filter</span>
|
3399
|
+
<span class='id identifier rubyid_count'>count</span> <span class='op'>+=</span> <span class='int'>1</span>
|
3400
|
+
|
3401
|
+
<span class='comment'># Skip until offset
|
3402
|
+
</span> <span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_offset'>offset</span> <span class='op'><</span> <span class='id identifier rubyid_count'>count</span>
|
3403
|
+
<span class='comment'># Break on limit reach
|
3404
|
+
</span> <span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_limit'>limit</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_matches'>matches</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'><</span> <span class='id identifier rubyid_limit'>limit</span>
|
3405
|
+
<span class='id identifier rubyid_matches'>matches</span> <span class='op'><<</span> <span class='id identifier rubyid_item'>item</span>
|
3406
|
+
<span class='kw'>end</span>
|
3407
|
+
<span class='id identifier rubyid_matches'>matches</span>
|
3408
|
+
<span class='kw'>end</span></pre>
|
3409
|
+
</td>
|
3410
|
+
</tr>
|
3411
|
+
</table>
|
3412
|
+
</div>
|
3413
|
+
|
3414
|
+
<div class="method_details ">
|
3415
|
+
<h3 class="signature " id="refetch-instance_method">
|
3416
|
+
|
3417
|
+
#<strong>refetch</strong>(job_id, gid) ⇒ <tt>Object</tt>
|
3418
|
+
|
3419
|
+
|
3420
|
+
|
3421
|
+
|
3422
|
+
|
3423
|
+
</h3><div class="docstring">
|
3424
|
+
<div class="discussion">
|
3425
|
+
|
3426
|
+
<p>Refetch a page.</p>
|
3427
|
+
|
3428
|
+
|
3429
|
+
</div>
|
3430
|
+
</div>
|
3431
|
+
<div class="tags">
|
3432
|
+
<p class="tag_title">Parameters:</p>
|
3433
|
+
<ul class="param">
|
3434
|
+
|
3435
|
+
<li>
|
3436
|
+
|
3437
|
+
<span class='name'>job_id</span>
|
3438
|
+
|
3439
|
+
|
3440
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
3441
|
+
|
3442
|
+
|
3443
|
+
|
3444
|
+
—
|
3445
|
+
<div class='inline'>
|
3446
|
+
<p>Page's job_id to refetch.</p>
|
3447
|
+
</div>
|
3448
|
+
|
3449
|
+
</li>
|
3450
|
+
|
3451
|
+
<li>
|
3452
|
+
|
3453
|
+
<span class='name'>gid</span>
|
3454
|
+
|
3455
|
+
|
3456
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3457
|
+
|
3458
|
+
|
3459
|
+
|
3460
|
+
—
|
3461
|
+
<div class='inline'>
|
3462
|
+
<p>Page's gid to refetch.</p>
|
3463
|
+
</div>
|
3464
|
+
|
3465
|
+
</li>
|
3466
|
+
|
3467
|
+
</ul>
|
3468
|
+
|
3469
|
+
<p class="tag_title">Raises:</p>
|
3470
|
+
<ul class="raise">
|
3471
|
+
|
3472
|
+
<li>
|
3473
|
+
|
3474
|
+
|
3475
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Exception.html" title="DhEasy::Core::Exception (module)">Exception</a></span></tt>)</span>
|
3476
|
+
|
3477
|
+
|
3478
|
+
|
3479
|
+
</li>
|
3480
|
+
|
3481
|
+
</ul>
|
3482
|
+
|
3483
|
+
</div><table class="source_code">
|
3484
|
+
<tr>
|
3485
|
+
<td>
|
3486
|
+
<pre class="lines">
|
3487
|
+
|
3488
|
+
|
3489
|
+
510
|
3490
|
+
511
|
3491
|
+
512
|
3492
|
+
513
|
3493
|
+
514
|
3494
|
+
515
|
3495
|
+
516
|
3496
|
+
517
|
3497
|
+
518
|
3498
|
+
519
|
3499
|
+
520
|
3500
|
+
521
|
3501
|
+
522
|
3502
|
+
523
|
3503
|
+
524
|
3504
|
+
525
|
3505
|
+
526
|
3506
|
+
527
|
3507
|
+
528
|
3508
|
+
529
|
3509
|
+
530
|
3510
|
+
531
|
3511
|
+
532
|
3512
|
+
533
|
3513
|
+
534
|
3514
|
+
535
|
3515
|
+
536
|
3516
|
+
537
|
3517
|
+
538
|
3518
|
+
539
|
3519
|
+
540
|
3520
|
+
541</pre>
|
3521
|
+
</td>
|
3522
|
+
<td>
|
3523
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 510</span>
|
3524
|
+
|
3525
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_refetch'>refetch</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_gid'>gid</span>
|
3526
|
+
<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_pages'>pages</span><span class='period'>.</span><span class='id identifier rubyid_find_match'>find_match</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gid</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
|
3527
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Exception.html" title="DhEasy::Core::Exception (module)">Exception</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Page not found with job_id \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_job_id'>job_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" gid \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gid'>gid</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
3528
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>status</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>to_fetch</span><span class='tstring_end'>'</span></span>
|
3529
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>freshness</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_time_stamp'>time_stamp</span>
|
3530
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>to_fetch</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_time_stamp'>time_stamp</span>
|
3531
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fetched_from</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3532
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fetching_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>2001-01-01T00:00:00Z</span><span class='tstring_end'>'</span></span>
|
3533
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fetched_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3534
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fetching_try_count</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
|
3535
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>effective_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3536
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3537
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_failed_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3538
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsed_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3539
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_try_count</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
|
3540
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_fail_count</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
|
3541
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_updated_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>2001-01-01T00:00:00Z</span><span class='tstring_end'>'</span></span>
|
3542
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response_checksum</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3543
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response_status</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3544
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response_status_code</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3545
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response_headers</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3546
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response_cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3547
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>response_proto</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3548
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>content_type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3549
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>content_size</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
|
3550
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>failed_response_status_code</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3551
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>failed_response_headers</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3552
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>failed_response_cookie</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3553
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>failed_effective_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3554
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>failed_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3555
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>failed_content_type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3556
|
+
<span class='kw'>end</span></pre>
|
3557
|
+
</td>
|
3558
|
+
</tr>
|
3559
|
+
</table>
|
3560
|
+
</div>
|
3561
|
+
|
3562
|
+
<div class="method_details ">
|
3563
|
+
<h3 class="signature " id="reparse-instance_method">
|
3564
|
+
|
3565
|
+
#<strong>reparse</strong>(job_id, gid) ⇒ <tt>Object</tt>
|
3566
|
+
|
3567
|
+
|
3568
|
+
|
3569
|
+
|
3570
|
+
|
3571
|
+
</h3><div class="docstring">
|
3572
|
+
<div class="discussion">
|
3573
|
+
|
3574
|
+
<p>Reparse a page.</p>
|
3575
|
+
|
3576
|
+
|
3577
|
+
</div>
|
3578
|
+
</div>
|
3579
|
+
<div class="tags">
|
3580
|
+
<p class="tag_title">Parameters:</p>
|
3581
|
+
<ul class="param">
|
3582
|
+
|
3583
|
+
<li>
|
3584
|
+
|
3585
|
+
<span class='name'>job_id</span>
|
3586
|
+
|
3587
|
+
|
3588
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
3589
|
+
|
3590
|
+
|
3591
|
+
|
3592
|
+
—
|
3593
|
+
<div class='inline'>
|
3594
|
+
<p>Page's job_id to reparse.</p>
|
3595
|
+
</div>
|
3596
|
+
|
3597
|
+
</li>
|
3598
|
+
|
3599
|
+
<li>
|
3600
|
+
|
3601
|
+
<span class='name'>gid</span>
|
3602
|
+
|
3603
|
+
|
3604
|
+
<span class='type'>(<tt>String</tt>)</span>
|
3605
|
+
|
3606
|
+
|
3607
|
+
|
3608
|
+
—
|
3609
|
+
<div class='inline'>
|
3610
|
+
<p>Page's gid to reparse.</p>
|
3611
|
+
</div>
|
3612
|
+
|
3613
|
+
</li>
|
3614
|
+
|
3615
|
+
</ul>
|
3616
|
+
|
3617
|
+
<p class="tag_title">Raises:</p>
|
3618
|
+
<ul class="raise">
|
3619
|
+
|
3620
|
+
<li>
|
3621
|
+
|
3622
|
+
|
3623
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Exception.html" title="DhEasy::Core::Exception (module)">Exception</a></span></tt>)</span>
|
3624
|
+
|
3625
|
+
|
3626
|
+
|
3627
|
+
</li>
|
3628
|
+
|
3629
|
+
</ul>
|
3630
|
+
|
3631
|
+
</div><table class="source_code">
|
3632
|
+
<tr>
|
3633
|
+
<td>
|
3634
|
+
<pre class="lines">
|
3635
|
+
|
3636
|
+
|
3637
|
+
547
|
3638
|
+
548
|
3639
|
+
549
|
3640
|
+
550
|
3641
|
+
551
|
3642
|
+
552
|
3643
|
+
553
|
3644
|
+
554
|
3645
|
+
555
|
3646
|
+
556
|
3647
|
+
557</pre>
|
3648
|
+
</td>
|
3649
|
+
<td>
|
3650
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 547</span>
|
3651
|
+
|
3652
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reparse'>reparse</span> <span class='id identifier rubyid_job_id'>job_id</span><span class='comma'>,</span> <span class='id identifier rubyid_gid'>gid</span>
|
3653
|
+
<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_pages'>pages</span><span class='period'>.</span><span class='id identifier rubyid_find_match'>find_match</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gid</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_gid'>gid</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>job_id</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='id identifier rubyid_job_id'>job_id</span><span class='rparen'>)</span>
|
3654
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Exception.html" title="DhEasy::Core::Exception (module)">Exception</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Page not found with job_id \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_job_id'>job_id</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" gid \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_gid'>gid</span><span class='embexpr_end'>}</span><span class='tstring_content'>\"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
3655
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>status</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>to_parse</span><span class='tstring_end'>'</span></span>
|
3656
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3657
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_failed_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3658
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_updated_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>2001-01-01T00:00:00Z</span><span class='tstring_end'>'</span></span>
|
3659
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsed_at</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
3660
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_try_count</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
|
3661
|
+
<span class='id identifier rubyid_page'>page</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>parsing_fail_count</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='int'>0</span>
|
3662
|
+
<span class='kw'>end</span></pre>
|
3663
|
+
</td>
|
3664
|
+
</tr>
|
3665
|
+
</table>
|
3666
|
+
</div>
|
3667
|
+
|
3668
|
+
<div class="method_details ">
|
3669
|
+
<h3 class="signature " id="scraper_name-instance_method">
|
3670
|
+
|
3671
|
+
#<strong>scraper_name</strong> ⇒ <tt>String</tt><sup>?</sup>
|
3672
|
+
|
3673
|
+
|
3674
|
+
|
3675
|
+
|
3676
|
+
|
3677
|
+
</h3><div class="docstring">
|
3678
|
+
<div class="discussion">
|
3679
|
+
|
3680
|
+
<p>Fake scraper_name.</p>
|
3681
|
+
|
3682
|
+
|
3683
|
+
</div>
|
3684
|
+
</div>
|
3685
|
+
<div class="tags">
|
3686
|
+
|
3687
|
+
<p class="tag_title">Returns:</p>
|
3688
|
+
<ul class="return">
|
3689
|
+
|
3690
|
+
<li>
|
3691
|
+
|
3692
|
+
|
3693
|
+
<span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
|
3694
|
+
|
3695
|
+
|
3696
|
+
|
3697
|
+
</li>
|
3698
|
+
|
3699
|
+
</ul>
|
3700
|
+
|
3701
|
+
</div><table class="source_code">
|
3702
|
+
<tr>
|
3703
|
+
<td>
|
3704
|
+
<pre class="lines">
|
3705
|
+
|
3706
|
+
|
3707
|
+
185
|
3708
|
+
186
|
3709
|
+
187</pre>
|
3710
|
+
</td>
|
3711
|
+
<td>
|
3712
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 185</span>
|
3713
|
+
|
3714
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scraper_name'>scraper_name</span>
|
3715
|
+
<span class='ivar'>@scraper_name</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>my_scraper</span><span class='tstring_end'>'</span></span>
|
3716
|
+
<span class='kw'>end</span></pre>
|
3717
|
+
</td>
|
3718
|
+
</tr>
|
3719
|
+
</table>
|
3720
|
+
</div>
|
3721
|
+
|
3722
|
+
<div class="method_details ">
|
3723
|
+
<h3 class="signature " id="scraper_name=-instance_method">
|
3724
|
+
|
3725
|
+
#<strong>scraper_name=</strong>(value) ⇒ <tt>Object</tt>
|
3726
|
+
|
3727
|
+
|
3728
|
+
|
3729
|
+
|
3730
|
+
|
3731
|
+
</h3><div class="docstring">
|
3732
|
+
<div class="discussion">
|
3733
|
+
|
3734
|
+
<p>Set fake scraper_name value.</p>
|
3735
|
+
|
3736
|
+
|
3737
|
+
</div>
|
3738
|
+
</div>
|
3739
|
+
<div class="tags">
|
3740
|
+
|
3741
|
+
|
3742
|
+
</div><table class="source_code">
|
3743
|
+
<tr>
|
3744
|
+
<td>
|
3745
|
+
<pre class="lines">
|
3746
|
+
|
3747
|
+
|
3748
|
+
190
|
3749
|
+
191
|
3750
|
+
192
|
3751
|
+
193
|
3752
|
+
194</pre>
|
3753
|
+
</td>
|
3754
|
+
<td>
|
3755
|
+
<pre class="code"><span class="info file"># File 'lib/dh_easy/core/mock/fake_db.rb', line 190</span>
|
3756
|
+
|
3757
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scraper_name='>scraper_name=</span> <span class='id identifier rubyid_value'>value</span>
|
3758
|
+
<span class='id identifier rubyid_job'>job</span> <span class='op'>=</span> <span class='id identifier rubyid_ensure_job'>ensure_job</span>
|
3759
|
+
<span class='ivar'>@scraper_name</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
3760
|
+
<span class='id identifier rubyid_job'>job</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>scraper_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_scraper_name'>scraper_name</span>
|
3761
|
+
<span class='kw'>end</span></pre>
|
3762
|
+
</td>
|
3763
|
+
</tr>
|
3764
|
+
</table>
|
3765
|
+
</div>
|
3766
|
+
|
3767
|
+
</div>
|
3768
|
+
|
3769
|
+
</div>
|
3770
|
+
|
3771
|
+
<div id="footer">
|
3772
|
+
Generated on Wed Dec 4 23:00:02 2019 by
|
3773
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
3774
|
+
0.9.20 (ruby-2.5.3).
|
3775
|
+
</div>
|
3776
|
+
|
3777
|
+
</div>
|
3778
|
+
</body>
|
3779
|
+
</html>
|