devdnsd 1.1.10 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,133 @@
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
+ Exception: DevDNSd::Errors::InvalidRule
8
+
9
+ &mdash; Documentation by YARD 0.8.2.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 (I)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../DevDNSd.html" title="DevDNSd (module)">DevDNSd</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Errors.html" title="DevDNSd::Errors (module)">Errors</a></span></span>
36
+ &raquo;
37
+ <span class="title">InvalidRule</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>Exception: DevDNSd::Errors::InvalidRule
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">ArgumentError</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ArgumentError</li>
82
+
83
+ <li class="next">DevDNSd::Errors::InvalidRule</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/devdnsd/errors.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>This exception is raised if a <span class='object_link'><a href="../Rule.html" title="DevDNSd::Rule (class)">Rule</a></span> is invalid.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ </div>
125
+
126
+ <div id="footer">
127
+ Generated on Wed Aug 22 13:48:31 2012 by
128
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
+ 0.8.2.1 (ruby-1.9.2).
130
+ </div>
131
+
132
+ </body>
133
+ </html>
@@ -0,0 +1,1469 @@
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
+ Class: DevDNSd::Rule
8
+
9
+ &mdash; Documentation by YARD 0.8.2.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 (R)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../DevDNSd.html" title="DevDNSd (module)">DevDNSd</a></span></span>
36
+ &raquo;
37
+ <span class="title">Rule</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>Class: DevDNSd::Rule
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">DevDNSd::Rule</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/devdnsd/rule.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>This class encapsulate a rule for matching an hostname.</p>
105
+
106
+
107
+ </div>
108
+ </div>
109
+ <div class="tags">
110
+
111
+
112
+ </div>
113
+
114
+
115
+
116
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
117
+ <ul class="summary">
118
+
119
+ <li class="public ">
120
+ <span class="summary_signature">
121
+
122
+ <a href="#block-instance_method" title="#block (instance method)">- (Object) <strong>block</strong> </a>
123
+
124
+
125
+
126
+ </span>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ <span class="summary_desc"><div class='inline'><p>An optional block to compute the reply instead of using the <code>reply</code> parameter.</p>
140
+ </div></span>
141
+
142
+ </li>
143
+
144
+
145
+ <li class="public ">
146
+ <span class="summary_signature">
147
+
148
+ <a href="#match-instance_method" title="#match (instance method)">- (Object) <strong>match</strong> </a>
149
+
150
+
151
+
152
+ </span>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <span class="summary_desc"><div class='inline'><p>The pattern to match.</p>
166
+ </div></span>
167
+
168
+ </li>
169
+
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ <span class="summary_desc"><div class='inline'><p>A list of options for the request.</p>
192
+ </div></span>
193
+
194
+ </li>
195
+
196
+
197
+ <li class="public ">
198
+ <span class="summary_signature">
199
+
200
+ <a href="#reply-instance_method" title="#reply (instance method)">- (Object) <strong>reply</strong> </a>
201
+
202
+
203
+
204
+ </span>
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <span class="summary_desc"><div class='inline'><p>The IP or hostname to reply back to the client.</p>
218
+ </div></span>
219
+
220
+ </li>
221
+
222
+
223
+ <li class="public ">
224
+ <span class="summary_signature">
225
+
226
+ <a href="#type-instance_method" title="#type (instance method)">- (Object) <strong>type</strong> </a>
227
+
228
+
229
+
230
+ </span>
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+ <span class="summary_desc"><div class='inline'><p>The type of request to match.</p>
244
+ </div></span>
245
+
246
+ </li>
247
+
248
+
249
+ </ul>
250
+
251
+
252
+
253
+
254
+
255
+ <h2>
256
+ Class Method Summary
257
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
258
+ </h2>
259
+
260
+ <ul class="summary">
261
+
262
+ <li class="public ">
263
+ <span class="summary_signature">
264
+
265
+ <a href="#create-class_method" title="create (class method)">+ (Object) <strong>create</strong>(match, reply_or_type = nil, type = nil, options = {}, &amp;block) </a>
266
+
267
+
268
+
269
+ </span>
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ <span class="summary_desc"><div class='inline'><p>Creates a new rule.</p>
280
+ </div></span>
281
+
282
+ </li>
283
+
284
+
285
+ <li class="public ">
286
+ <span class="summary_signature">
287
+
288
+ <a href="#resource_class_to_symbol-class_method" title="resource_class_to_symbol (class method)">+ (Symbol) <strong>resource_class_to_symbol</strong>(klass) </a>
289
+
290
+
291
+
292
+ </span>
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <span class="summary_desc"><div class='inline'><p>Converts a class to the correspondent symbol.</p>
303
+ </div></span>
304
+
305
+ </li>
306
+
307
+
308
+ <li class="public ">
309
+ <span class="summary_signature">
310
+
311
+ <a href="#symbol_to_resource_class-class_method" title="symbol_to_resource_class (class method)">+ (Symbol) <strong>symbol_to_resource_class</strong>(symbol) </a>
312
+
313
+
314
+
315
+ </span>
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+ <span class="summary_desc"><div class='inline'><p>Converts a symbol to the correspondent DNS resource class.</p>
326
+ </div></span>
327
+
328
+ </li>
329
+
330
+
331
+ </ul>
332
+
333
+ <h2>
334
+ Instance Method Summary
335
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
336
+ </h2>
337
+
338
+ <ul class="summary">
339
+
340
+ <li class="public ">
341
+ <span class="summary_signature">
342
+
343
+ <a href="#has_block%3F-instance_method" title="#has_block? (instance method)">- (Boolean) <strong>has_block?</strong> </a>
344
+
345
+
346
+
347
+ </span>
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+ <span class="summary_desc"><div class='inline'><p>Checks if the rule is a regexp.</p>
358
+ </div></span>
359
+
360
+ </li>
361
+
362
+
363
+ <li class="public ">
364
+ <span class="summary_signature">
365
+
366
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Rule) <strong>initialize</strong>(match = /.+/, reply = &quot;127.0.0.1&quot;, type = :A, options = {}, &amp;block) </a>
367
+
368
+
369
+
370
+ </span>
371
+
372
+
373
+ <span class="note title constructor">constructor</span>
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ <span class="summary_desc"><div class='inline'><p>Creates a new rule.</p>
383
+ </div></span>
384
+
385
+ </li>
386
+
387
+
388
+ <li class="public ">
389
+ <span class="summary_signature">
390
+
391
+ <a href="#is_regexp%3F-instance_method" title="#is_regexp? (instance method)">- (Boolean) <strong>is_regexp?</strong> </a>
392
+
393
+
394
+
395
+ </span>
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+ <span class="summary_desc"><div class='inline'><p>Checks if the rule is a regexp.</p>
406
+ </div></span>
407
+
408
+ </li>
409
+
410
+
411
+ <li class="public ">
412
+ <span class="summary_signature">
413
+
414
+ <a href="#match_host-instance_method" title="#match_host (instance method)">- (MatchData|Boolean|Nil) <strong>match_host</strong>(hostname) </a>
415
+
416
+
417
+
418
+ </span>
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+ <span class="summary_desc"><div class='inline'><p>Matches a hostname to the rule.</p>
429
+ </div></span>
430
+
431
+ </li>
432
+
433
+
434
+ <li class="public ">
435
+ <span class="summary_signature">
436
+
437
+ <a href="#resource_class-instance_method" title="#resource_class (instance method)">- (Array|Class) <strong>resource_class</strong> </a>
438
+
439
+
440
+
441
+ </span>
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+ <span class="summary_desc"><div class='inline'><p>Returns the resource class(es) for the current rule.</p>
452
+ </div></span>
453
+
454
+ </li>
455
+
456
+
457
+ </ul>
458
+
459
+
460
+ <div id="constructor_details" class="method_details_list">
461
+ <h2>Constructor Details</h2>
462
+
463
+ <div class="method_details first">
464
+ <h3 class="signature first" id="initialize-instance_method">
465
+
466
+ - (<tt><span class='object_link'><a href="" title="DevDNSd::Rule (class)">Rule</a></span></tt>) <strong>initialize</strong>(match = /.+/, reply = &quot;127.0.0.1&quot;, type = :A, options = {}, &amp;block)
467
+
468
+
469
+
470
+
471
+
472
+ </h3><div class="docstring">
473
+ <div class="discussion">
474
+ <p>Creates a new rule.</p>
475
+
476
+
477
+ </div>
478
+ </div>
479
+ <div class="tags">
480
+ <p class="tag_title">Parameters:</p>
481
+ <ul class="param">
482
+
483
+ <li>
484
+
485
+ <span class='name'>match</span>
486
+
487
+
488
+ <span class='type'>(<tt>String|Regexp</tt>)</span>
489
+
490
+
491
+ <em class="default">(defaults to: <tt>/.+/</tt>)</em>
492
+
493
+
494
+ &mdash;
495
+ <div class='inline'><p>The pattern to match.</p>
496
+ </div>
497
+
498
+ </li>
499
+
500
+ <li>
501
+
502
+ <span class='name'>reply</span>
503
+
504
+
505
+ <span class='type'>(<tt>String</tt>)</span>
506
+
507
+
508
+ <em class="default">(defaults to: <tt>&quot;127.0.0.1&quot;</tt>)</em>
509
+
510
+
511
+ &mdash;
512
+ <div class='inline'><p>The IP or hostname to reply back to the client.</p>
513
+ </div>
514
+
515
+ </li>
516
+
517
+ <li>
518
+
519
+ <span class='name'>type</span>
520
+
521
+
522
+ <span class='type'>(<tt>Symbol</tt>)</span>
523
+
524
+
525
+ <em class="default">(defaults to: <tt>:A</tt>)</em>
526
+
527
+
528
+ &mdash;
529
+ <div class='inline'><p>The type of request to match.</p>
530
+ </div>
531
+
532
+ </li>
533
+
534
+ <li>
535
+
536
+ <span class='name'>options</span>
537
+
538
+
539
+ <span class='type'>(<tt>Hash</tt>)</span>
540
+
541
+
542
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
543
+
544
+
545
+ &mdash;
546
+ <div class='inline'><p>A list of options for the request.</p>
547
+ </div>
548
+
549
+ </li>
550
+
551
+ <li>
552
+
553
+ <span class='name'>block</span>
554
+
555
+
556
+ <span class='type'>(<tt>Proc</tt>)</span>
557
+
558
+
559
+
560
+ &mdash;
561
+ <div class='inline'><p>An optional block to compute the reply instead of using the <code>reply</code> parameter.</p>
562
+ </div>
563
+
564
+ </li>
565
+
566
+ </ul>
567
+
568
+ <p class="tag_title">Raises:</p>
569
+ <ul class="raise">
570
+
571
+ <li>
572
+
573
+
574
+ <span class='type'>(<tt><span class='object_link'><a href="Errors/InvalidRule.html" title="DevDNSd::Errors::InvalidRule (class)">DevDNSd::Errors::InvalidRule</a></span></tt>)</span>
575
+
576
+
577
+
578
+ </li>
579
+
580
+ </ul>
581
+
582
+ <p class="tag_title">See Also:</p>
583
+ <ul class="see">
584
+
585
+ <li><span class='object_link'><a href="#create-class_method" title="DevDNSd::Rule.create (method)">create</a></span></li>
586
+
587
+ </ul>
588
+
589
+ </div><table class="source_code">
590
+ <tr>
591
+ <td>
592
+ <pre class="lines">
593
+
594
+
595
+ 39
596
+ 40
597
+ 41
598
+ 42
599
+ 43
600
+ 44
601
+ 45
602
+ 46
603
+ 47
604
+ 48
605
+ 49
606
+ 50</pre>
607
+ </td>
608
+ <td>
609
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 39</span>
610
+
611
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</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='comma'>,</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='symbol'>:A</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
612
+ <span class='id identifier rubyid_reply'>reply</span> <span class='op'>||=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>&quot;</span></span>
613
+ <span class='id identifier rubyid_type'>type</span> <span class='op'>||=</span> <span class='symbol'>:A</span>
614
+ <span class='ivar'>@match</span> <span class='op'>=</span> <span class='id identifier rubyid_match'>match</span>
615
+ <span class='ivar'>@type</span> <span class='op'>=</span> <span class='id identifier rubyid_type'>type</span>
616
+ <span class='ivar'>@reply</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='id identifier rubyid_reply'>reply</span> <span class='op'>:</span> <span class='kw'>nil</span>
617
+ <span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
618
+ <span class='ivar'>@block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
619
+
620
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>You must specify at least a rule and a host (also via a block). Optionally you can add a record type (default: A) and the options.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@reply</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
621
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>You can only use hashs for options.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
622
+ <span class='kw'>end</span></pre>
623
+ </td>
624
+ </tr>
625
+ </table>
626
+ </div>
627
+
628
+ </div>
629
+
630
+ <div id="instance_attr_details" class="attr_details">
631
+ <h2>Instance Attribute Details</h2>
632
+
633
+
634
+ <span id="block=-instance_method"></span>
635
+ <div class="method_details first">
636
+ <h3 class="signature first" id="block-instance_method">
637
+
638
+ - (<tt>Object</tt>) <strong>block</strong>
639
+
640
+
641
+
642
+
643
+
644
+ </h3><div class="docstring">
645
+ <div class="discussion">
646
+ <p>An optional block to compute the reply instead of using the <code>reply</code> parameter.</p>
647
+
648
+
649
+ </div>
650
+ </div>
651
+ <div class="tags">
652
+
653
+
654
+ <p class="tag_title">See Also:</p>
655
+ <ul class="see">
656
+
657
+ <li><span class='object_link'><a href="#create-class_method" title="DevDNSd::Rule.create (method)">create</a></span></li>
658
+
659
+ </ul>
660
+
661
+ </div><table class="source_code">
662
+ <tr>
663
+ <td>
664
+ <pre class="lines">
665
+
666
+
667
+ 29
668
+ 30
669
+ 31</pre>
670
+ </td>
671
+ <td>
672
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 29</span>
673
+
674
+ <span class='kw'>def</span> <span class='id identifier rubyid_block'>block</span>
675
+ <span class='ivar'>@block</span>
676
+ <span class='kw'>end</span></pre>
677
+ </td>
678
+ </tr>
679
+ </table>
680
+ </div>
681
+
682
+
683
+ <span id="match=-instance_method"></span>
684
+ <div class="method_details ">
685
+ <h3 class="signature " id="match-instance_method">
686
+
687
+ - (<tt>Object</tt>) <strong>match</strong>
688
+
689
+
690
+
691
+
692
+
693
+ </h3><div class="docstring">
694
+ <div class="discussion">
695
+ <p>The pattern to match. Default: <code>/.+/</code>.</p>
696
+
697
+
698
+ </div>
699
+ </div>
700
+ <div class="tags">
701
+
702
+
703
+ </div><table class="source_code">
704
+ <tr>
705
+ <td>
706
+ <pre class="lines">
707
+
708
+
709
+ 11
710
+ 12
711
+ 13</pre>
712
+ </td>
713
+ <td>
714
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 11</span>
715
+
716
+ <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span>
717
+ <span class='ivar'>@match</span>
718
+ <span class='kw'>end</span></pre>
719
+ </td>
720
+ </tr>
721
+ </table>
722
+ </div>
723
+
724
+
725
+ <span id="options=-instance_method"></span>
726
+ <div class="method_details ">
727
+ <h3 class="signature " id="options-instance_method">
728
+
729
+ - (<tt>Object</tt>) <strong>options</strong>
730
+
731
+
732
+
733
+
734
+
735
+ </h3><div class="docstring">
736
+ <div class="discussion">
737
+ <p>A list of options for the request. Default is an empty hash.</p>
738
+
739
+
740
+ </div>
741
+ </div>
742
+ <div class="tags">
743
+
744
+
745
+ </div><table class="source_code">
746
+ <tr>
747
+ <td>
748
+ <pre class="lines">
749
+
750
+
751
+ 24
752
+ 25
753
+ 26</pre>
754
+ </td>
755
+ <td>
756
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 24</span>
757
+
758
+ <span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
759
+ <span class='ivar'>@options</span>
760
+ <span class='kw'>end</span></pre>
761
+ </td>
762
+ </tr>
763
+ </table>
764
+ </div>
765
+
766
+
767
+ <span id="reply=-instance_method"></span>
768
+ <div class="method_details ">
769
+ <h3 class="signature " id="reply-instance_method">
770
+
771
+ - (<tt>Object</tt>) <strong>reply</strong>
772
+
773
+
774
+
775
+
776
+
777
+ </h3><div class="docstring">
778
+ <div class="discussion">
779
+ <p>The IP or hostname to reply back to the client. Default: <code>127.0.0.1</code>.</p>
780
+
781
+
782
+ </div>
783
+ </div>
784
+ <div class="tags">
785
+
786
+
787
+ <p class="tag_title">See Also:</p>
788
+ <ul class="see">
789
+
790
+ <li><span class='object_link'><a href="#create-class_method" title="DevDNSd::Rule.create (method)">create</a></span></li>
791
+
792
+ </ul>
793
+
794
+ </div><table class="source_code">
795
+ <tr>
796
+ <td>
797
+ <pre class="lines">
798
+
799
+
800
+ 21
801
+ 22
802
+ 23</pre>
803
+ </td>
804
+ <td>
805
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 21</span>
806
+
807
+ <span class='kw'>def</span> <span class='id identifier rubyid_reply'>reply</span>
808
+ <span class='ivar'>@reply</span>
809
+ <span class='kw'>end</span></pre>
810
+ </td>
811
+ </tr>
812
+ </table>
813
+ </div>
814
+
815
+
816
+ <span id="type=-instance_method"></span>
817
+ <div class="method_details ">
818
+ <h3 class="signature " id="type-instance_method">
819
+
820
+ - (<tt>Object</tt>) <strong>type</strong>
821
+
822
+
823
+
824
+
825
+
826
+ </h3><div class="docstring">
827
+ <div class="discussion">
828
+ <p>The type of request to match. Default: <code>:A</code>.</p>
829
+
830
+
831
+ </div>
832
+ </div>
833
+ <div class="tags">
834
+
835
+
836
+ <p class="tag_title">See Also:</p>
837
+ <ul class="see">
838
+
839
+ <li><span class='object_link'><a href="#create-class_method" title="DevDNSd::Rule.create (method)">create</a></span></li>
840
+
841
+ </ul>
842
+
843
+ </div><table class="source_code">
844
+ <tr>
845
+ <td>
846
+ <pre class="lines">
847
+
848
+
849
+ 16
850
+ 17
851
+ 18</pre>
852
+ </td>
853
+ <td>
854
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 16</span>
855
+
856
+ <span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
857
+ <span class='ivar'>@type</span>
858
+ <span class='kw'>end</span></pre>
859
+ </td>
860
+ </tr>
861
+ </table>
862
+ </div>
863
+
864
+ </div>
865
+
866
+
867
+ <div id="class_method_details" class="method_details_list">
868
+ <h2>Class Method Details</h2>
869
+
870
+
871
+ <div class="method_details first">
872
+ <h3 class="signature first" id="create-class_method">
873
+
874
+ + (<tt>Object</tt>) <strong>create</strong>(match, reply_or_type = nil, type = nil, options = {}, &amp;block)
875
+
876
+
877
+
878
+
879
+
880
+ </h3><div class="docstring">
881
+ <div class="discussion">
882
+ <p>Creates a new rule.</p>
883
+
884
+
885
+ </div>
886
+ </div>
887
+ <div class="tags">
888
+ <p class="tag_title">Parameters:</p>
889
+ <ul class="param">
890
+
891
+ <li>
892
+
893
+ <span class='name'>match</span>
894
+
895
+
896
+ <span class='type'>(<tt>String|Regexp</tt>)</span>
897
+
898
+
899
+
900
+ &mdash;
901
+ <div class='inline'><p>The pattern to match.</p>
902
+ </div>
903
+
904
+ </li>
905
+
906
+ <li>
907
+
908
+ <span class='name'>reply_or_type</span>
909
+
910
+
911
+ <span class='type'>(<tt>String|Symbol</tt>)</span>
912
+
913
+
914
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
915
+
916
+
917
+ &mdash;
918
+ <div class='inline'><p>The IP or hostname to reply back to the client (or the type of request to match, if a block is provided).</p>
919
+ </div>
920
+
921
+ </li>
922
+
923
+ <li>
924
+
925
+ <span class='name'>type</span>
926
+
927
+
928
+ <span class='type'>(<tt>Symbol</tt>)</span>
929
+
930
+
931
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
932
+
933
+
934
+ &mdash;
935
+ <div class='inline'><p>The type of request to match. This is ignored if a block is provided.</p>
936
+ </div>
937
+
938
+ </li>
939
+
940
+ <li>
941
+
942
+ <span class='name'>options</span>
943
+
944
+
945
+ <span class='type'>(<tt>Hash</tt>)</span>
946
+
947
+
948
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
949
+
950
+
951
+ &mdash;
952
+ <div class='inline'><p>A list of options for the request.</p>
953
+ </div>
954
+
955
+ </li>
956
+
957
+ <li>
958
+
959
+ <span class='name'>block</span>
960
+
961
+
962
+ <span class='type'>(<tt>Proc</tt>)</span>
963
+
964
+
965
+
966
+ &mdash;
967
+ <div class='inline'><p>An optional block to compute the reply instead of using the <code>reply_or_type</code> parameter. In this case <code>reply_or_type</code> is used for the type of the request and <code>type</code> is ignored.</p>
968
+ </div>
969
+
970
+ </li>
971
+
972
+ </ul>
973
+
974
+ <p class="tag_title">Raises:</p>
975
+ <ul class="raise">
976
+
977
+ <li>
978
+
979
+
980
+ <span class='type'>(<tt><span class='object_link'><a href="Errors/InvalidRule.html" title="DevDNSd::Errors::InvalidRule (class)">DevDNSd::Errors::InvalidRule</a></span></tt>)</span>
981
+
982
+
983
+
984
+ </li>
985
+
986
+ </ul>
987
+
988
+ </div><table class="source_code">
989
+ <tr>
990
+ <td>
991
+ <pre class="lines">
992
+
993
+
994
+ 89
995
+ 90
996
+ 91
997
+ 92
998
+ 93
999
+ 94
1000
+ 95
1001
+ 96
1002
+ 97
1003
+ 98
1004
+ 99
1005
+ 100
1006
+ 101
1007
+ 102
1008
+ 103
1009
+ 104
1010
+ 105
1011
+ 106</pre>
1012
+ </td>
1013
+ <td>
1014
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 89</span>
1015
+
1016
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='comma'>,</span> <span class='id identifier rubyid_reply_or_type'>reply_or_type</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
1017
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>You must specify at least a rule and a host (also via a block). Optionally you can add a record type (default: A) and the options.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_reply_or_type'>reply_or_type</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1018
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>You can only use hashs for options.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span>
1019
+
1020
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='rparen'>)</span>
1021
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
1022
+
1023
+ <span class='kw'>if</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='kw'>then</span> <span class='comment'># reply_or_type acts like a type, type is ignored
1024
+ </span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_reply_or_type'>reply_or_type</span> <span class='op'>||</span> <span class='symbol'>:A</span>
1025
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='kw'>nil</span>
1026
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
1027
+ <span class='kw'>else</span> <span class='comment'># reply_or_type acts like a reply
1028
+ </span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_reply'>reply</span> <span class='op'>=</span> <span class='id identifier rubyid_reply_or_type'>reply_or_type</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>127.0.0.1</span><span class='tstring_end'>&quot;</span></span>
1029
+ <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='id identifier rubyid_type'>type</span> <span class='op'>||</span> <span class='symbol'>:A</span>
1030
+ <span class='kw'>end</span>
1031
+
1032
+ <span class='id identifier rubyid_rv'>rv</span>
1033
+ <span class='kw'>end</span></pre>
1034
+ </td>
1035
+ </tr>
1036
+ </table>
1037
+ </div>
1038
+
1039
+ <div class="method_details ">
1040
+ <h3 class="signature " id="resource_class_to_symbol-class_method">
1041
+
1042
+ + (<tt>Symbol</tt>) <strong>resource_class_to_symbol</strong>(klass)
1043
+
1044
+
1045
+
1046
+
1047
+
1048
+ </h3><div class="docstring">
1049
+ <div class="discussion">
1050
+ <p>Converts a class to the correspondent symbol.</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'>klass</span>
1062
+
1063
+
1064
+ <span class='type'>(<tt>Class</tt>)</span>
1065
+
1066
+
1067
+
1068
+ &mdash;
1069
+ <div class='inline'><p>The class to convert.</p>
1070
+ </div>
1071
+
1072
+ </li>
1073
+
1074
+ </ul>
1075
+
1076
+ <p class="tag_title">Returns:</p>
1077
+ <ul class="return">
1078
+
1079
+ <li>
1080
+
1081
+
1082
+ <span class='type'>(<tt>Symbol</tt>)</span>
1083
+
1084
+
1085
+
1086
+ &mdash;
1087
+ <div class='inline'><p>The symbol representation of the class.</p>
1088
+ </div>
1089
+
1090
+ </li>
1091
+
1092
+ </ul>
1093
+
1094
+ </div><table class="source_code">
1095
+ <tr>
1096
+ <td>
1097
+ <pre class="lines">
1098
+
1099
+
1100
+ 112
1101
+ 113
1102
+ 114</pre>
1103
+ </td>
1104
+ <td>
1105
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 112</span>
1106
+
1107
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_resource_class_to_symbol'>resource_class_to_symbol</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
1108
+ <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</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='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\\2</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
1109
+ <span class='kw'>end</span></pre>
1110
+ </td>
1111
+ </tr>
1112
+ </table>
1113
+ </div>
1114
+
1115
+ <div class="method_details ">
1116
+ <h3 class="signature " id="symbol_to_resource_class-class_method">
1117
+
1118
+ + (<tt>Symbol</tt>) <strong>symbol_to_resource_class</strong>(symbol)
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+ </h3><div class="docstring">
1125
+ <div class="discussion">
1126
+ <p>Converts a symbol to the correspondent DNS resource class.</p>
1127
+
1128
+
1129
+ </div>
1130
+ </div>
1131
+ <div class="tags">
1132
+ <p class="tag_title">Parameters:</p>
1133
+ <ul class="param">
1134
+
1135
+ <li>
1136
+
1137
+ <span class='name'>symbol</span>
1138
+
1139
+
1140
+ <span class='type'>(<tt>Symbol</tt>)</span>
1141
+
1142
+
1143
+
1144
+ &mdash;
1145
+ <div class='inline'><p>The symbol to convert.</p>
1146
+ </div>
1147
+
1148
+ </li>
1149
+
1150
+ </ul>
1151
+
1152
+ <p class="tag_title">Returns:</p>
1153
+ <ul class="return">
1154
+
1155
+ <li>
1156
+
1157
+
1158
+ <span class='type'>(<tt>Symbol</tt>)</span>
1159
+
1160
+
1161
+
1162
+ &mdash;
1163
+ <div class='inline'><p>The class associated to the symbol.</p>
1164
+ </div>
1165
+
1166
+ </li>
1167
+
1168
+ </ul>
1169
+
1170
+ </div><table class="source_code">
1171
+ <tr>
1172
+ <td>
1173
+ <pre class="lines">
1174
+
1175
+
1176
+ 120
1177
+ 121
1178
+ 122
1179
+ 123
1180
+ 124
1181
+ 125
1182
+ 126
1183
+ 127
1184
+ 128</pre>
1185
+ </td>
1186
+ <td>
1187
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 120</span>
1188
+
1189
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_symbol_to_resource_class'>symbol_to_resource_class</span><span class='lparen'>(</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rparen'>)</span>
1190
+ <span class='id identifier rubyid_symbol'>symbol</span> <span class='op'>=</span> <span class='id identifier rubyid_symbol'>symbol</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span>
1191
+
1192
+ <span class='kw'>begin</span>
1193
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Resolv::DNS::Resource::IN::</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span>
1194
+ <span class='kw'>rescue</span> <span class='op'>::</span><span class='const'>NameError</span>
1195
+ <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>DevDNSd</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>InvalidRule</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Invalid resource class </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_symbol'>symbol</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
1196
+ <span class='kw'>end</span>
1197
+ <span class='kw'>end</span></pre>
1198
+ </td>
1199
+ </tr>
1200
+ </table>
1201
+ </div>
1202
+
1203
+ </div>
1204
+
1205
+ <div id="instance_method_details" class="method_details_list">
1206
+ <h2>Instance Method Details</h2>
1207
+
1208
+
1209
+ <div class="method_details first">
1210
+ <h3 class="signature first" id="has_block?-instance_method">
1211
+
1212
+ - (<tt>Boolean</tt>) <strong>has_block?</strong>
1213
+
1214
+
1215
+
1216
+
1217
+
1218
+ </h3><div class="docstring">
1219
+ <div class="discussion">
1220
+ <p>Checks if the rule is a regexp.</p>
1221
+
1222
+
1223
+ </div>
1224
+ </div>
1225
+ <div class="tags">
1226
+
1227
+ <p class="tag_title">Returns:</p>
1228
+ <ul class="return">
1229
+
1230
+ <li>
1231
+
1232
+
1233
+ <span class='type'>(<tt>Boolean</tt>)</span>
1234
+
1235
+
1236
+
1237
+ &mdash;
1238
+ <div class='inline'><p><code>true</code> if the rule has a block, <code>false</code> otherwise.</p>
1239
+ </div>
1240
+
1241
+ </li>
1242
+
1243
+ </ul>
1244
+
1245
+ </div><table class="source_code">
1246
+ <tr>
1247
+ <td>
1248
+ <pre class="lines">
1249
+
1250
+
1251
+ 70
1252
+ 71
1253
+ 72</pre>
1254
+ </td>
1255
+ <td>
1256
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 70</span>
1257
+
1258
+ <span class='kw'>def</span> <span class='id identifier rubyid_has_block?'>has_block?</span>
1259
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span>
1260
+ <span class='kw'>end</span></pre>
1261
+ </td>
1262
+ </tr>
1263
+ </table>
1264
+ </div>
1265
+
1266
+ <div class="method_details ">
1267
+ <h3 class="signature " id="is_regexp?-instance_method">
1268
+
1269
+ - (<tt>Boolean</tt>) <strong>is_regexp?</strong>
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+ </h3><div class="docstring">
1276
+ <div class="discussion">
1277
+ <p>Checks if the rule is a regexp.</p>
1278
+
1279
+
1280
+ </div>
1281
+ </div>
1282
+ <div class="tags">
1283
+
1284
+ <p class="tag_title">Returns:</p>
1285
+ <ul class="return">
1286
+
1287
+ <li>
1288
+
1289
+
1290
+ <span class='type'>(<tt>Boolean</tt>)</span>
1291
+
1292
+
1293
+
1294
+ &mdash;
1295
+ <div class='inline'><p><code>true</code> if the rule is a Regexp, <code>false</code> otherwise.</p>
1296
+ </div>
1297
+
1298
+ </li>
1299
+
1300
+ </ul>
1301
+
1302
+ </div><table class="source_code">
1303
+ <tr>
1304
+ <td>
1305
+ <pre class="lines">
1306
+
1307
+
1308
+ 63
1309
+ 64
1310
+ 65</pre>
1311
+ </td>
1312
+ <td>
1313
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 63</span>
1314
+
1315
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_regexp?'>is_regexp?</span>
1316
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Regexp</span><span class='rparen'>)</span>
1317
+ <span class='kw'>end</span></pre>
1318
+ </td>
1319
+ </tr>
1320
+ </table>
1321
+ </div>
1322
+
1323
+ <div class="method_details ">
1324
+ <h3 class="signature " id="match_host-instance_method">
1325
+
1326
+ - (<tt>MatchData|Boolean|Nil</tt>) <strong>match_host</strong>(hostname)
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+ </h3><div class="docstring">
1333
+ <div class="discussion">
1334
+ <p>Matches a hostname to the rule.</p>
1335
+
1336
+
1337
+ </div>
1338
+ </div>
1339
+ <div class="tags">
1340
+ <p class="tag_title">Parameters:</p>
1341
+ <ul class="param">
1342
+
1343
+ <li>
1344
+
1345
+ <span class='name'>hostname</span>
1346
+
1347
+
1348
+ <span class='type'>(<tt>String</tt>)</span>
1349
+
1350
+
1351
+
1352
+ &mdash;
1353
+ <div class='inline'><p>The hostname to match.</p>
1354
+ </div>
1355
+
1356
+ </li>
1357
+
1358
+ </ul>
1359
+
1360
+ <p class="tag_title">Returns:</p>
1361
+ <ul class="return">
1362
+
1363
+ <li>
1364
+
1365
+
1366
+ <span class='type'>(<tt>MatchData|Boolean|Nil</tt>)</span>
1367
+
1368
+
1369
+
1370
+ &mdash;
1371
+ <div class='inline'><p>Return <code>true</code> or MatchData (if the pattern is a regexp) if the rule matches, <code>false</code> or <code>nil</code> otherwise.</p>
1372
+ </div>
1373
+
1374
+ </li>
1375
+
1376
+ </ul>
1377
+
1378
+ </div><table class="source_code">
1379
+ <tr>
1380
+ <td>
1381
+ <pre class="lines">
1382
+
1383
+
1384
+ 78
1385
+ 79
1386
+ 80</pre>
1387
+ </td>
1388
+ <td>
1389
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 78</span>
1390
+
1391
+ <span class='kw'>def</span> <span class='id identifier rubyid_match_host'>match_host</span><span class='lparen'>(</span><span class='id identifier rubyid_hostname'>hostname</span><span class='rparen'>)</span>
1392
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_is_regexp?'>is_regexp?</span> <span class='op'>?</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_hostname'>hostname</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span> <span class='op'>==</span> <span class='id identifier rubyid_hostname'>hostname</span><span class='rparen'>)</span>
1393
+ <span class='kw'>end</span></pre>
1394
+ </td>
1395
+ </tr>
1396
+ </table>
1397
+ </div>
1398
+
1399
+ <div class="method_details ">
1400
+ <h3 class="signature " id="resource_class-instance_method">
1401
+
1402
+ - (<tt>Array|Class</tt>) <strong>resource_class</strong>
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+ </h3><div class="docstring">
1409
+ <div class="discussion">
1410
+ <p>Returns the resource class(es) for the current rule.</p>
1411
+
1412
+
1413
+ </div>
1414
+ </div>
1415
+ <div class="tags">
1416
+
1417
+ <p class="tag_title">Returns:</p>
1418
+ <ul class="return">
1419
+
1420
+ <li>
1421
+
1422
+
1423
+ <span class='type'>(<tt>Array|Class</tt>)</span>
1424
+
1425
+
1426
+
1427
+ &mdash;
1428
+ <div class='inline'><p>The class(es) for the current rule.</p>
1429
+ </div>
1430
+
1431
+ </li>
1432
+
1433
+ </ul>
1434
+
1435
+ </div><table class="source_code">
1436
+ <tr>
1437
+ <td>
1438
+ <pre class="lines">
1439
+
1440
+
1441
+ 55
1442
+ 56
1443
+ 57
1444
+ 58</pre>
1445
+ </td>
1446
+ <td>
1447
+ <pre class="code"><span class="info file"># File 'lib/devdnsd/rule.rb', line 55</span>
1448
+
1449
+ <span class='kw'>def</span> <span class='id identifier rubyid_resource_class'>resource_class</span>
1450
+ <span class='id identifier rubyid_classes'>classes</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_cls'>cls</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_symbol_to_resource_class'>symbol_to_resource_class</span><span class='lparen'>(</span><span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span>
1451
+ <span class='id identifier rubyid_classes'>classes</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span> <span class='op'>?</span> <span class='id identifier rubyid_classes'>classes</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='op'>:</span> <span class='id identifier rubyid_classes'>classes</span>
1452
+ <span class='kw'>end</span></pre>
1453
+ </td>
1454
+ </tr>
1455
+ </table>
1456
+ </div>
1457
+
1458
+ </div>
1459
+
1460
+ </div>
1461
+
1462
+ <div id="footer">
1463
+ Generated on Wed Aug 22 13:48:31 2012 by
1464
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1465
+ 0.8.2.1 (ruby-1.9.2).
1466
+ </div>
1467
+
1468
+ </body>
1469
+ </html>