devdnsd 1.7.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis-gemfile +14 -0
- data/.travis.yml +4 -4
- data/Gemfile +13 -1
- data/README.md +6 -3
- data/Rakefile +1 -8
- data/bin/devdnsd +15 -13
- data/devdnsd.gemspec +6 -13
- data/doc/DevDNSd/Application.html +1096 -1651
- data/doc/DevDNSd/ApplicationMethods/Server.html +517 -0
- data/doc/DevDNSd/ApplicationMethods/System/ClassMethods.html +372 -0
- data/doc/DevDNSd/ApplicationMethods/System.html +956 -0
- data/doc/DevDNSd/ApplicationMethods.html +125 -0
- data/doc/DevDNSd/Configuration.html +7 -6
- data/doc/DevDNSd/Errors/InvalidRule.html +3 -3
- data/doc/DevDNSd/Errors.html +3 -3
- data/doc/DevDNSd/Rule.html +1685 -218
- data/doc/DevDNSd/Version.html +5 -5
- data/doc/DevDNSd.html +6 -6
- data/doc/_index.html +43 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +47 -40
- data/doc/frames.html +1 -1
- data/doc/index.html +47 -40
- data/doc/method_list.html +69 -45
- data/doc/top-level-namespace.html +3 -3
- data/lib/devdnsd/application.rb +382 -290
- data/lib/devdnsd/configuration.rb +9 -9
- data/lib/devdnsd/errors.rb +1 -1
- data/lib/devdnsd/rule.rb +84 -48
- data/lib/devdnsd/version.rb +3 -3
- data/lib/devdnsd.rb +5 -2
- data/locales/en.yml +48 -0
- data/locales/it.yml +48 -0
- data/spec/coverage_helper.rb +6 -9
- data/spec/devdnsd/application_spec.rb +62 -42
- data/spec/devdnsd/configuration_spec.rb +1 -1
- data/spec/devdnsd/rule_spec.rb +7 -7
- data/spec/spec_helper.rb +1 -2
- data/utils/tester.rb +13 -27
- metadata +17 -142
- data/Gemfile.lock +0 -101
@@ -0,0 +1,517 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: DevDNSd::ApplicationMethods::Server
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.4.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (S)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../DevDNSd.html" title="DevDNSd (module)">DevDNSd</a></span></span> » <span class='title'><span class='object_link'><a href="../ApplicationMethods.html" title="DevDNSd::ApplicationMethods (module)">ApplicationMethods</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Server</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: DevDNSd::ApplicationMethods::Server
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
<dt class="r1">Included in:</dt>
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Application.html" title="DevDNSd::Application (class)">DevDNSd::Application</a></span></dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
86
|
+
<dd class="r2 last">lib/devdnsd/application.rb</dd>
|
87
|
+
|
88
|
+
</dl>
|
89
|
+
<div class="clear"></div>
|
90
|
+
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p>Methods to process requests.</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#perform_server-instance_method" title="#perform_server (instance method)">- (Object) <strong>perform_server</strong> </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Starts the DNS server.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#process_rule-instance_method" title="#process_rule (instance method)">- (Object) <strong>process_rule</strong>(rule, type, match_data, transaction) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'><p>Processes a DNS rule.</p>
|
157
|
+
</div></span>
|
158
|
+
|
159
|
+
</li>
|
160
|
+
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature">
|
164
|
+
|
165
|
+
<a href="#process_rule_in_classes-instance_method" title="#process_rule_in_classes (instance method)">- (Object) <strong>process_rule_in_classes</strong>(rule, match_data, transaction) </a>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<span class="summary_desc"><div class='inline'><p>Processes a rule against a set of DNS resource classes.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<div id="instance_method_details" class="method_details_list">
|
191
|
+
<h2>Instance Method Details</h2>
|
192
|
+
|
193
|
+
|
194
|
+
<div class="method_details first">
|
195
|
+
<h3 class="signature first" id="perform_server-instance_method">
|
196
|
+
|
197
|
+
- (<tt>Object</tt>) <strong>perform_server</strong>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</h3><div class="docstring">
|
204
|
+
<div class="discussion">
|
205
|
+
<p>Starts the DNS server.</p>
|
206
|
+
|
207
|
+
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
<div class="tags">
|
211
|
+
|
212
|
+
<p class="tag_title">Returns:</p>
|
213
|
+
<ul class="return">
|
214
|
+
|
215
|
+
<li>
|
216
|
+
|
217
|
+
|
218
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
—
|
223
|
+
<div class='inline'><p>The result of stop callbacks.</p>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
</ul>
|
229
|
+
|
230
|
+
</div><table class="source_code">
|
231
|
+
<tr>
|
232
|
+
<td>
|
233
|
+
<pre class="lines">
|
234
|
+
|
235
|
+
|
236
|
+
279
|
237
|
+
280
|
238
|
+
281
|
239
|
+
282
|
240
|
+
283
|
241
|
+
284
|
242
|
+
285
|
243
|
+
286
|
244
|
+
287
|
245
|
+
288
|
246
|
+
289
|
247
|
+
290
|
248
|
+
291
|
249
|
+
292
|
250
|
+
293
|
251
|
+
294</pre>
|
252
|
+
</td>
|
253
|
+
<td>
|
254
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 279</span>
|
255
|
+
|
256
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_perform_server'>perform_server</span>
|
257
|
+
<span class='id identifier rubyid_application'>application</span> <span class='op'>=</span> <span class='kw'>self</span>
|
258
|
+
<span class='const'>RubyDNS</span><span class='op'>::</span><span class='id identifier rubyid_run_server'>run_server</span><span class='lparen'>(</span><span class='label'>listen:</span> <span class='lbracket'>[</span><span class='lbracket'>[</span><span class='symbol'>:udp</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='period'>.</span><span class='id identifier rubyid_to_integer'>to_integer</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
259
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span> <span class='op'>=</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span>
|
260
|
+
|
261
|
+
<span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>.+</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_CLASSES</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='op'>|</span>
|
262
|
+
<span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_append_question!'>append_question!</span>
|
263
|
+
<span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_rule'>rule</span><span class='op'>|</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_process_rule_in_classes'>process_rule_in_classes</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='comment'># During debugging, wrap the inside of the block with a begin rescue and PRINT the exception because RubyDNS hides it.
|
264
|
+
</span> <span class='kw'>end</span>
|
265
|
+
|
266
|
+
<span class='comment'># Default DNS handler and event handlers
|
267
|
+
</span> <span class='id identifier rubyid_otherwise'>otherwise</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_transaction'>transaction</span><span class='op'>|</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_failure!'>failure!</span><span class='lparen'>(</span><span class='symbol'>:NXDomain</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
268
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='symbol'>:start</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_on_start'>on_start</span> <span class='rbrace'>}</span>
|
269
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='symbol'>:stop</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_application'>application</span><span class='period'>.</span><span class='id identifier rubyid_on_stop'>on_stop</span> <span class='rbrace'>}</span>
|
270
|
+
<span class='kw'>end</span>
|
271
|
+
<span class='kw'>end</span></pre>
|
272
|
+
</td>
|
273
|
+
</tr>
|
274
|
+
</table>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div class="method_details ">
|
278
|
+
<h3 class="signature " id="process_rule-instance_method">
|
279
|
+
|
280
|
+
- (<tt>Object</tt>) <strong>process_rule</strong>(rule, type, match_data, transaction)
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
</h3><div class="docstring">
|
287
|
+
<div class="discussion">
|
288
|
+
<p>Processes a DNS rule.</p>
|
289
|
+
|
290
|
+
|
291
|
+
</div>
|
292
|
+
</div>
|
293
|
+
<div class="tags">
|
294
|
+
<p class="tag_title">Parameters:</p>
|
295
|
+
<ul class="param">
|
296
|
+
|
297
|
+
<li>
|
298
|
+
|
299
|
+
<span class='name'>rule</span>
|
300
|
+
|
301
|
+
|
302
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Rule.html" title="DevDNSd::Rule (class)">Rule</a></span></tt>)</span>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
—
|
307
|
+
<div class='inline'><p>The rule to process.</p>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
</li>
|
311
|
+
|
312
|
+
<li>
|
313
|
+
|
314
|
+
<span class='name'>type</span>
|
315
|
+
|
316
|
+
|
317
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
—
|
322
|
+
<div class='inline'><p>The type of the query.</p>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</li>
|
326
|
+
|
327
|
+
<li>
|
328
|
+
|
329
|
+
<span class='name'>match_data</span>
|
330
|
+
|
331
|
+
|
332
|
+
<span class='type'>(<tt>MatchData|nil</tt>)</span>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
—
|
337
|
+
<div class='inline'><p>If the rule pattern was a Regexp, then this holds the match data, otherwise <code>nil</code> is passed.</p>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
</li>
|
341
|
+
|
342
|
+
<li>
|
343
|
+
|
344
|
+
<span class='name'>transaction</span>
|
345
|
+
|
346
|
+
|
347
|
+
<span class='type'>(<tt>RubyDNS::Transaction</tt>)</span>
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
—
|
352
|
+
<div class='inline'><p>The current DNS transaction (http://rubydoc.info/gems/rubydns/RubyDNS/Transaction).</p>
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</li>
|
356
|
+
|
357
|
+
</ul>
|
358
|
+
|
359
|
+
|
360
|
+
</div><table class="source_code">
|
361
|
+
<tr>
|
362
|
+
<td>
|
363
|
+
<pre class="lines">
|
364
|
+
|
365
|
+
|
366
|
+
302
|
367
|
+
303
|
368
|
+
304
|
369
|
+
305
|
370
|
+
306
|
371
|
+
307
|
372
|
+
308
|
373
|
+
309
|
374
|
+
310
|
375
|
+
311
|
376
|
+
312
|
377
|
+
313</pre>
|
378
|
+
</td>
|
379
|
+
<td>
|
380
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 302</span>
|
381
|
+
|
382
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_rule'>process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span>
|
383
|
+
<span class='id identifier rubyid_reply'>reply</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_process_rule'>perform_process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span>
|
384
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_reply'>reply</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_i18n'>i18n</span><span class='period'>.</span><span class='id identifier rubyid_no_reply'>no_reply</span><span class='rparen'>)</span>
|
385
|
+
|
386
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_reply'>reply</span> <span class='kw'>then</span>
|
387
|
+
<span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_respond!'>respond!</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_finalize_reply'>finalize_reply</span><span class='lparen'>(</span><span class='id identifier rubyid_reply'>reply</span><span class='comma'>,</span> <span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
388
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>==</span> <span class='kw'>false</span> <span class='kw'>then</span>
|
389
|
+
<span class='kw'>false</span>
|
390
|
+
<span class='kw'>else</span>
|
391
|
+
<span class='kw'>nil</span>
|
392
|
+
<span class='kw'>end</span>
|
393
|
+
<span class='kw'>end</span></pre>
|
394
|
+
</td>
|
395
|
+
</tr>
|
396
|
+
</table>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
<div class="method_details ">
|
400
|
+
<h3 class="signature " id="process_rule_in_classes-instance_method">
|
401
|
+
|
402
|
+
- (<tt>Object</tt>) <strong>process_rule_in_classes</strong>(rule, match_data, transaction)
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</h3><div class="docstring">
|
409
|
+
<div class="discussion">
|
410
|
+
<p>Processes a rule against a set of DNS resource classes.</p>
|
411
|
+
|
412
|
+
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
<div class="tags">
|
416
|
+
<p class="tag_title">Parameters:</p>
|
417
|
+
<ul class="param">
|
418
|
+
|
419
|
+
<li>
|
420
|
+
|
421
|
+
<span class='name'>rule</span>
|
422
|
+
|
423
|
+
|
424
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Rule.html" title="DevDNSd::Rule (class)">Rule</a></span></tt>)</span>
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
—
|
429
|
+
<div class='inline'><p>The rule to process.</p>
|
430
|
+
</div>
|
431
|
+
|
432
|
+
</li>
|
433
|
+
|
434
|
+
<li>
|
435
|
+
|
436
|
+
<span class='name'>match_data</span>
|
437
|
+
|
438
|
+
|
439
|
+
<span class='type'>(<tt>MatchData|nil</tt>)</span>
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
—
|
444
|
+
<div class='inline'><p>If the rule pattern was a Regexp, then this holds the match data, otherwise <code>nil</code> is passed.</p>
|
445
|
+
</div>
|
446
|
+
|
447
|
+
</li>
|
448
|
+
|
449
|
+
<li>
|
450
|
+
|
451
|
+
<span class='name'>transaction</span>
|
452
|
+
|
453
|
+
|
454
|
+
<span class='type'>(<tt>RubyDNS::Transaction</tt>)</span>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
—
|
459
|
+
<div class='inline'><p>The current DNS transaction (http://rubydoc.info/gems/rubydns/RubyDNS/Transaction).</p>
|
460
|
+
</div>
|
461
|
+
|
462
|
+
</li>
|
463
|
+
|
464
|
+
</ul>
|
465
|
+
|
466
|
+
|
467
|
+
</div><table class="source_code">
|
468
|
+
<tr>
|
469
|
+
<td>
|
470
|
+
<pre class="lines">
|
471
|
+
|
472
|
+
|
473
|
+
320
|
474
|
+
321
|
475
|
+
322
|
476
|
+
323
|
477
|
+
324
|
478
|
+
325
|
479
|
+
326
|
480
|
+
327
|
481
|
+
328
|
482
|
+
329
|
483
|
+
330
|
484
|
+
331</pre>
|
485
|
+
</td>
|
486
|
+
<td>
|
487
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 320</span>
|
488
|
+
|
489
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_process_rule_in_classes'>process_rule_in_classes</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_match_data'>match_data</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span>
|
490
|
+
<span class='comment'># Get the subset of handled class that is valid for the rule
|
491
|
+
</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_CLASSES</span> <span class='op'>&</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span>
|
492
|
+
<span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>=</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span> <span class='op'>&</span> <span class='lbracket'>[</span><span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='period'>.</span><span class='id identifier rubyid_resource_class'>resource_class</span> <span class='op'>!=</span> <span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Application</span><span class='op'>::</span><span class='const'>ANY_REQUEST</span>
|
493
|
+
|
494
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_resource_classes'>resource_classes</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='kw'>then</span>
|
495
|
+
<span class='id identifier rubyid_resource_classes'>resource_classes</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_resource_class'>resource_class</span><span class='op'>|</span> <span class='comment'># Now for every class
|
496
|
+
</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>=</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_match_host'>match_host</span><span class='lparen'>(</span><span class='id identifier rubyid_match_data'>match_data</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
497
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_process_rule'>process_rule</span><span class='lparen'>(</span><span class='id identifier rubyid_rule'>rule</span><span class='comma'>,</span> <span class='id identifier rubyid_resource_class'>resource_class</span><span class='comma'>,</span> <span class='id identifier rubyid_rule'>rule</span><span class='period'>.</span><span class='id identifier rubyid_is_regexp?'>is_regexp?</span> <span class='op'>?</span> <span class='id identifier rubyid_matches'>matches</span> <span class='op'>:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_transaction'>transaction</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_matches'>matches</span>
|
498
|
+
<span class='kw'>end</span>
|
499
|
+
<span class='kw'>end</span>
|
500
|
+
<span class='kw'>end</span></pre>
|
501
|
+
</td>
|
502
|
+
</tr>
|
503
|
+
</table>
|
504
|
+
</div>
|
505
|
+
|
506
|
+
</div>
|
507
|
+
|
508
|
+
</div>
|
509
|
+
|
510
|
+
<div id="footer">
|
511
|
+
Generated on Sun Feb 10 13:20:33 2013 by
|
512
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
513
|
+
0.8.4.1 (ruby-1.9.3).
|
514
|
+
</div>
|
515
|
+
|
516
|
+
</body>
|
517
|
+
</html>
|