brauser 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1035 @@
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: Brauser::Definition
8
+
9
+ &mdash; Documentation by YARD 0.8.6.1
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
+ 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 (D)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Brauser.html" title="Brauser (module)">Brauser</a></span></span>
36
+ &raquo;
37
+ <span class="title">Definition</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: Brauser::Definition
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">Brauser::Definition</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/brauser/definition.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>A class which hold a definition of a browser, a platform or a language
105
+ This class represents a detection of the current user browser.</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#label-instance_method" title="#label (instance method)">- (String) <strong>label</strong> </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <span class="summary_desc"><div class='inline'><p>A human readable label for this definition.</p>
141
+ </div></span>
142
+
143
+ </li>
144
+
145
+
146
+ <li class="public ">
147
+ <span class="summary_signature">
148
+
149
+ <a href="#primary-instance_method" title="#primary (instance method)">- (String|Symbol|Proc) <strong>primary</strong> </a>
150
+
151
+
152
+
153
+ </span>
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+ <span class="summary_desc"><div class='inline'><p>The primary matcher of this definition.</p>
167
+ </div></span>
168
+
169
+ </li>
170
+
171
+
172
+ <li class="public ">
173
+ <span class="summary_signature">
174
+
175
+ <a href="#secondary-instance_method" title="#secondary (instance method)">- (String|Symbol|Proc) <strong>secondary</strong> </a>
176
+
177
+
178
+
179
+ </span>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <span class="summary_desc"><div class='inline'><p>The secondary matcher of this definition.</p>
193
+ </div></span>
194
+
195
+ </li>
196
+
197
+
198
+ <li class="public ">
199
+ <span class="summary_signature">
200
+
201
+ <a href="#tag-instance_method" title="#tag (instance method)">- (String|Symbol) <strong>tag</strong> </a>
202
+
203
+
204
+
205
+ </span>
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ <span class="summary_desc"><div class='inline'><p>An identifier for this definition.</p>
219
+ </div></span>
220
+
221
+ </li>
222
+
223
+
224
+ </ul>
225
+
226
+
227
+
228
+
229
+
230
+ <h2>
231
+ Instance Method Summary
232
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
233
+ </h2>
234
+
235
+ <ul class="summary">
236
+
237
+ <li class="public ">
238
+ <span class="summary_signature">
239
+
240
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Definition) <strong>initialize</strong>(tag = nil, label = nil, primary = nil, secondary = nil) </a>
241
+
242
+
243
+
244
+ </span>
245
+
246
+
247
+ <span class="note title constructor">constructor</span>
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ <span class="summary_desc"><div class='inline'><p>Creates a new definition.</p>
257
+ </div></span>
258
+
259
+ </li>
260
+
261
+
262
+ <li class="public ">
263
+ <span class="summary_signature">
264
+
265
+ <a href="#match-instance_method" title="#match (instance method)">- (Object|NilClass) <strong>match</strong>(type, *args) </a>
266
+
267
+
268
+
269
+ </span>
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ <span class="summary_desc"><div class='inline'><p>Performs a match of this definition.</p>
280
+ </div></span>
281
+
282
+ </li>
283
+
284
+
285
+ </ul>
286
+
287
+
288
+ <div id="constructor_details" class="method_details_list">
289
+ <h2>Constructor Details</h2>
290
+
291
+ <div class="method_details first">
292
+ <h3 class="signature first" id="initialize-instance_method">
293
+
294
+ - (<tt><span class='object_link'><a href="" title="Brauser::Definition (class)">Definition</a></span></tt>) <strong>initialize</strong>(tag = nil, label = nil, primary = nil, secondary = nil)
295
+
296
+
297
+
298
+
299
+
300
+ </h3><div class="docstring">
301
+ <div class="discussion">
302
+ <p>Creates a new definition.</p>
303
+
304
+
305
+ </div>
306
+ </div>
307
+ <div class="tags">
308
+ <p class="tag_title">Parameters:</p>
309
+ <ul class="param">
310
+
311
+ <li>
312
+
313
+ <span class='name'>tag</span>
314
+
315
+
316
+ <span class='type'>(<tt>String|Symbol</tt>)</span>
317
+
318
+
319
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
320
+
321
+
322
+ &mdash;
323
+ <div class='inline'><p>An identifier for this definition.</p>
324
+ </div>
325
+
326
+ </li>
327
+
328
+ <li>
329
+
330
+ <span class='name'>label</span>
331
+
332
+
333
+ <span class='type'>(<tt>String</tt>)</span>
334
+
335
+
336
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
337
+
338
+
339
+ &mdash;
340
+ <div class='inline'><p>A human readable label for this definition.</p>
341
+ </div>
342
+
343
+ </li>
344
+
345
+ <li>
346
+
347
+ <span class='name'>primary</span>
348
+
349
+
350
+ <span class='type'>(<tt>String|Symbol|Proc</tt>)</span>
351
+
352
+
353
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
354
+
355
+
356
+ &mdash;
357
+ <div class='inline'><p>The primary matcher of this definition.</p>
358
+ </div>
359
+
360
+ </li>
361
+
362
+ <li>
363
+
364
+ <span class='name'>secondary</span>
365
+
366
+
367
+ <span class='type'>(<tt>String|Symbol|Proc</tt>)</span>
368
+
369
+
370
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
371
+
372
+
373
+ &mdash;
374
+ <div class='inline'><p>The secondary matcher of this definition.</p>
375
+ </div>
376
+
377
+ </li>
378
+
379
+ </ul>
380
+
381
+
382
+ </div><table class="source_code">
383
+ <tr>
384
+ <td>
385
+ <pre class="lines">
386
+
387
+
388
+ 28
389
+ 29
390
+ 30
391
+ 31
392
+ 32
393
+ 33</pre>
394
+ </td>
395
+ <td>
396
+ <pre class="code"><span class="info file"># File 'lib/brauser/definition.rb', line 28</span>
397
+
398
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
399
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_tag'>tag</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span>
400
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_label'>label</span> <span class='kw'>if</span> <span class='id identifier rubyid_label'>label</span>
401
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='id identifier rubyid_primary'>primary</span> <span class='kw'>if</span> <span class='id identifier rubyid_primary'>primary</span>
402
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='kw'>if</span> <span class='id identifier rubyid_secondary'>secondary</span>
403
+ <span class='kw'>end</span></pre>
404
+ </td>
405
+ </tr>
406
+ </table>
407
+ </div>
408
+
409
+ </div>
410
+
411
+ <div id="instance_attr_details" class="attr_details">
412
+ <h2>Instance Attribute Details</h2>
413
+
414
+
415
+ <span id="label=-instance_method"></span>
416
+ <div class="method_details first">
417
+ <h3 class="signature first" id="label-instance_method">
418
+
419
+ - (<tt>String</tt>) <strong>label</strong>
420
+
421
+
422
+
423
+
424
+
425
+ </h3><div class="docstring">
426
+ <div class="discussion">
427
+ <p>A human readable label for this definition.</p>
428
+
429
+
430
+ </div>
431
+ </div>
432
+ <div class="tags">
433
+
434
+ <p class="tag_title">Returns:</p>
435
+ <ul class="return">
436
+
437
+ <li>
438
+
439
+
440
+ <span class='type'>(<tt>String</tt>)</span>
441
+
442
+
443
+
444
+ &mdash;
445
+ <div class='inline'><p>A human readable label for this definition.</p>
446
+ </div>
447
+
448
+ </li>
449
+
450
+ </ul>
451
+
452
+ </div><table class="source_code">
453
+ <tr>
454
+ <td>
455
+ <pre class="lines">
456
+
457
+
458
+ 19
459
+ 20
460
+ 21
461
+ 22
462
+ 23
463
+ 24
464
+ 25
465
+ 26
466
+ 27
467
+ 28
468
+ 29
469
+ 30
470
+ 31
471
+ 32
472
+ 33
473
+ 34
474
+ 35
475
+ 36
476
+ 37
477
+ 38
478
+ 39
479
+ 40
480
+ 41
481
+ 42
482
+ 43
483
+ 44
484
+ 45
485
+ 46
486
+ 47
487
+ 48
488
+ 49
489
+ 50
490
+ 51
491
+ 52
492
+ 53</pre>
493
+ </td>
494
+ <td>
495
+ <pre class="code"><span class="info file"># File 'lib/brauser/definition.rb', line 19</span>
496
+
497
+ <span class='kw'>class</span> <span class='const'>Definition</span>
498
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tag</span><span class='comma'>,</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:primary</span><span class='comma'>,</span> <span class='symbol'>:secondary</span>
499
+
500
+ <span class='comment'># Creates a new definition.
501
+ </span> <span class='comment'>#
502
+ </span> <span class='comment'># @param tag [String|Symbol] An identifier for this definition.
503
+ </span> <span class='comment'># @param label [String] A human readable label for this definition.
504
+ </span> <span class='comment'># @param primary [String|Symbol|Proc] The primary matcher of this definition.
505
+ </span> <span class='comment'># @param secondary [String|Symbol|Proc] The secondary matcher of this definition.
506
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
507
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_tag'>tag</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span>
508
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_label'>label</span> <span class='kw'>if</span> <span class='id identifier rubyid_label'>label</span>
509
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='id identifier rubyid_primary'>primary</span> <span class='kw'>if</span> <span class='id identifier rubyid_primary'>primary</span>
510
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='kw'>if</span> <span class='id identifier rubyid_secondary'>secondary</span>
511
+ <span class='kw'>end</span>
512
+
513
+ <span class='comment'># Performs a match of this definition.
514
+ </span> <span class='comment'>#
515
+ </span> <span class='comment'># @param type [Symbol] The matcher to perform. Can be `:primary` (default) or `:secondary`.
516
+ </span> <span class='comment'># @param args [Array] Arguments to pass to the matcher. The first is the definition itself.
517
+ </span> <span class='comment'># @return [Object|NilClass] A match if matcher succeeded, `nil` otherwise.
518
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
519
+ <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>||</span> <span class='symbol'>:primary</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
520
+
521
+ <span class='kw'>if</span> <span class='id identifier rubyid_matcher'>matcher</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> <span class='kw'>then</span>
522
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
523
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>then</span>
524
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
525
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span>
526
+ <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>?</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
527
+ <span class='kw'>else</span>
528
+ <span class='kw'>nil</span>
529
+ <span class='kw'>end</span>
530
+ <span class='kw'>end</span>
531
+ <span class='kw'>end</span></pre>
532
+ </td>
533
+ </tr>
534
+ </table>
535
+ </div>
536
+
537
+
538
+ <span id="primary=-instance_method"></span>
539
+ <div class="method_details ">
540
+ <h3 class="signature " id="primary-instance_method">
541
+
542
+ - (<tt>String|Symbol|Proc</tt>) <strong>primary</strong>
543
+
544
+
545
+
546
+
547
+
548
+ </h3><div class="docstring">
549
+ <div class="discussion">
550
+ <p>The primary matcher of this definition. Used to match browser engine, platform name and language.</p>
551
+
552
+
553
+ </div>
554
+ </div>
555
+ <div class="tags">
556
+
557
+ <p class="tag_title">Returns:</p>
558
+ <ul class="return">
559
+
560
+ <li>
561
+
562
+
563
+ <span class='type'>(<tt>String|Symbol|Proc</tt>)</span>
564
+
565
+
566
+
567
+ &mdash;
568
+ <div class='inline'><p>The primary matcher of this definition. Used to match browser engine, platform name and language.</p>
569
+ </div>
570
+
571
+ </li>
572
+
573
+ </ul>
574
+
575
+ </div><table class="source_code">
576
+ <tr>
577
+ <td>
578
+ <pre class="lines">
579
+
580
+
581
+ 19
582
+ 20
583
+ 21
584
+ 22
585
+ 23
586
+ 24
587
+ 25
588
+ 26
589
+ 27
590
+ 28
591
+ 29
592
+ 30
593
+ 31
594
+ 32
595
+ 33
596
+ 34
597
+ 35
598
+ 36
599
+ 37
600
+ 38
601
+ 39
602
+ 40
603
+ 41
604
+ 42
605
+ 43
606
+ 44
607
+ 45
608
+ 46
609
+ 47
610
+ 48
611
+ 49
612
+ 50
613
+ 51
614
+ 52
615
+ 53</pre>
616
+ </td>
617
+ <td>
618
+ <pre class="code"><span class="info file"># File 'lib/brauser/definition.rb', line 19</span>
619
+
620
+ <span class='kw'>class</span> <span class='const'>Definition</span>
621
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tag</span><span class='comma'>,</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:primary</span><span class='comma'>,</span> <span class='symbol'>:secondary</span>
622
+
623
+ <span class='comment'># Creates a new definition.
624
+ </span> <span class='comment'>#
625
+ </span> <span class='comment'># @param tag [String|Symbol] An identifier for this definition.
626
+ </span> <span class='comment'># @param label [String] A human readable label for this definition.
627
+ </span> <span class='comment'># @param primary [String|Symbol|Proc] The primary matcher of this definition.
628
+ </span> <span class='comment'># @param secondary [String|Symbol|Proc] The secondary matcher of this definition.
629
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
630
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_tag'>tag</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span>
631
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_label'>label</span> <span class='kw'>if</span> <span class='id identifier rubyid_label'>label</span>
632
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='id identifier rubyid_primary'>primary</span> <span class='kw'>if</span> <span class='id identifier rubyid_primary'>primary</span>
633
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='kw'>if</span> <span class='id identifier rubyid_secondary'>secondary</span>
634
+ <span class='kw'>end</span>
635
+
636
+ <span class='comment'># Performs a match of this definition.
637
+ </span> <span class='comment'>#
638
+ </span> <span class='comment'># @param type [Symbol] The matcher to perform. Can be `:primary` (default) or `:secondary`.
639
+ </span> <span class='comment'># @param args [Array] Arguments to pass to the matcher. The first is the definition itself.
640
+ </span> <span class='comment'># @return [Object|NilClass] A match if matcher succeeded, `nil` otherwise.
641
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
642
+ <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>||</span> <span class='symbol'>:primary</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
643
+
644
+ <span class='kw'>if</span> <span class='id identifier rubyid_matcher'>matcher</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> <span class='kw'>then</span>
645
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
646
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>then</span>
647
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
648
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span>
649
+ <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>?</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
650
+ <span class='kw'>else</span>
651
+ <span class='kw'>nil</span>
652
+ <span class='kw'>end</span>
653
+ <span class='kw'>end</span>
654
+ <span class='kw'>end</span></pre>
655
+ </td>
656
+ </tr>
657
+ </table>
658
+ </div>
659
+
660
+
661
+ <span id="secondary=-instance_method"></span>
662
+ <div class="method_details ">
663
+ <h3 class="signature " id="secondary-instance_method">
664
+
665
+ - (<tt>String|Symbol|Proc</tt>) <strong>secondary</strong>
666
+
667
+
668
+
669
+
670
+
671
+ </h3><div class="docstring">
672
+ <div class="discussion">
673
+ <p>The secondary matcher of this definition. Used to match browser version.</p>
674
+
675
+
676
+ </div>
677
+ </div>
678
+ <div class="tags">
679
+
680
+ <p class="tag_title">Returns:</p>
681
+ <ul class="return">
682
+
683
+ <li>
684
+
685
+
686
+ <span class='type'>(<tt>String|Symbol|Proc</tt>)</span>
687
+
688
+
689
+
690
+ &mdash;
691
+ <div class='inline'><p>The secondary matcher of this definition. Used to match browser version.</p>
692
+ </div>
693
+
694
+ </li>
695
+
696
+ </ul>
697
+
698
+ </div><table class="source_code">
699
+ <tr>
700
+ <td>
701
+ <pre class="lines">
702
+
703
+
704
+ 19
705
+ 20
706
+ 21
707
+ 22
708
+ 23
709
+ 24
710
+ 25
711
+ 26
712
+ 27
713
+ 28
714
+ 29
715
+ 30
716
+ 31
717
+ 32
718
+ 33
719
+ 34
720
+ 35
721
+ 36
722
+ 37
723
+ 38
724
+ 39
725
+ 40
726
+ 41
727
+ 42
728
+ 43
729
+ 44
730
+ 45
731
+ 46
732
+ 47
733
+ 48
734
+ 49
735
+ 50
736
+ 51
737
+ 52
738
+ 53</pre>
739
+ </td>
740
+ <td>
741
+ <pre class="code"><span class="info file"># File 'lib/brauser/definition.rb', line 19</span>
742
+
743
+ <span class='kw'>class</span> <span class='const'>Definition</span>
744
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tag</span><span class='comma'>,</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:primary</span><span class='comma'>,</span> <span class='symbol'>:secondary</span>
745
+
746
+ <span class='comment'># Creates a new definition.
747
+ </span> <span class='comment'>#
748
+ </span> <span class='comment'># @param tag [String|Symbol] An identifier for this definition.
749
+ </span> <span class='comment'># @param label [String] A human readable label for this definition.
750
+ </span> <span class='comment'># @param primary [String|Symbol|Proc] The primary matcher of this definition.
751
+ </span> <span class='comment'># @param secondary [String|Symbol|Proc] The secondary matcher of this definition.
752
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
753
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_tag'>tag</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span>
754
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_label'>label</span> <span class='kw'>if</span> <span class='id identifier rubyid_label'>label</span>
755
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='id identifier rubyid_primary'>primary</span> <span class='kw'>if</span> <span class='id identifier rubyid_primary'>primary</span>
756
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='kw'>if</span> <span class='id identifier rubyid_secondary'>secondary</span>
757
+ <span class='kw'>end</span>
758
+
759
+ <span class='comment'># Performs a match of this definition.
760
+ </span> <span class='comment'>#
761
+ </span> <span class='comment'># @param type [Symbol] The matcher to perform. Can be `:primary` (default) or `:secondary`.
762
+ </span> <span class='comment'># @param args [Array] Arguments to pass to the matcher. The first is the definition itself.
763
+ </span> <span class='comment'># @return [Object|NilClass] A match if matcher succeeded, `nil` otherwise.
764
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
765
+ <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>||</span> <span class='symbol'>:primary</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
766
+
767
+ <span class='kw'>if</span> <span class='id identifier rubyid_matcher'>matcher</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> <span class='kw'>then</span>
768
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
769
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>then</span>
770
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
771
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span>
772
+ <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>?</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
773
+ <span class='kw'>else</span>
774
+ <span class='kw'>nil</span>
775
+ <span class='kw'>end</span>
776
+ <span class='kw'>end</span>
777
+ <span class='kw'>end</span></pre>
778
+ </td>
779
+ </tr>
780
+ </table>
781
+ </div>
782
+
783
+
784
+ <span id="tag=-instance_method"></span>
785
+ <div class="method_details ">
786
+ <h3 class="signature " id="tag-instance_method">
787
+
788
+ - (<tt>String|Symbol</tt>) <strong>tag</strong>
789
+
790
+
791
+
792
+
793
+
794
+ </h3><div class="docstring">
795
+ <div class="discussion">
796
+ <p>An identifier for this definition.</p>
797
+
798
+
799
+ </div>
800
+ </div>
801
+ <div class="tags">
802
+
803
+ <p class="tag_title">Returns:</p>
804
+ <ul class="return">
805
+
806
+ <li>
807
+
808
+
809
+ <span class='type'>(<tt>String|Symbol</tt>)</span>
810
+
811
+
812
+
813
+ &mdash;
814
+ <div class='inline'><p>An identifier for this definition.</p>
815
+ </div>
816
+
817
+ </li>
818
+
819
+ </ul>
820
+
821
+ </div><table class="source_code">
822
+ <tr>
823
+ <td>
824
+ <pre class="lines">
825
+
826
+
827
+ 19
828
+ 20
829
+ 21
830
+ 22
831
+ 23
832
+ 24
833
+ 25
834
+ 26
835
+ 27
836
+ 28
837
+ 29
838
+ 30
839
+ 31
840
+ 32
841
+ 33
842
+ 34
843
+ 35
844
+ 36
845
+ 37
846
+ 38
847
+ 39
848
+ 40
849
+ 41
850
+ 42
851
+ 43
852
+ 44
853
+ 45
854
+ 46
855
+ 47
856
+ 48
857
+ 49
858
+ 50
859
+ 51
860
+ 52
861
+ 53</pre>
862
+ </td>
863
+ <td>
864
+ <pre class="code"><span class="info file"># File 'lib/brauser/definition.rb', line 19</span>
865
+
866
+ <span class='kw'>class</span> <span class='const'>Definition</span>
867
+ <span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:tag</span><span class='comma'>,</span> <span class='symbol'>:label</span><span class='comma'>,</span> <span class='symbol'>:primary</span><span class='comma'>,</span> <span class='symbol'>:secondary</span>
868
+
869
+ <span class='comment'># Creates a new definition.
870
+ </span> <span class='comment'>#
871
+ </span> <span class='comment'># @param tag [String|Symbol] An identifier for this definition.
872
+ </span> <span class='comment'># @param label [String] A human readable label for this definition.
873
+ </span> <span class='comment'># @param primary [String|Symbol|Proc] The primary matcher of this definition.
874
+ </span> <span class='comment'># @param secondary [String|Symbol|Proc] The secondary matcher of this definition.
875
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
876
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='id identifier rubyid_tag'>tag</span> <span class='kw'>if</span> <span class='id identifier rubyid_tag'>tag</span>
877
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_label'>label</span> <span class='op'>=</span> <span class='id identifier rubyid_label'>label</span> <span class='kw'>if</span> <span class='id identifier rubyid_label'>label</span>
878
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_primary'>primary</span> <span class='op'>=</span> <span class='id identifier rubyid_primary'>primary</span> <span class='kw'>if</span> <span class='id identifier rubyid_primary'>primary</span>
879
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_secondary'>secondary</span> <span class='op'>=</span> <span class='id identifier rubyid_secondary'>secondary</span> <span class='kw'>if</span> <span class='id identifier rubyid_secondary'>secondary</span>
880
+ <span class='kw'>end</span>
881
+
882
+ <span class='comment'># Performs a match of this definition.
883
+ </span> <span class='comment'>#
884
+ </span> <span class='comment'># @param type [Symbol] The matcher to perform. Can be `:primary` (default) or `:secondary`.
885
+ </span> <span class='comment'># @param args [Array] Arguments to pass to the matcher. The first is the definition itself.
886
+ </span> <span class='comment'># @return [Object|NilClass] A match if matcher succeeded, `nil` otherwise.
887
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
888
+ <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>||</span> <span class='symbol'>:primary</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
889
+
890
+ <span class='kw'>if</span> <span class='id identifier rubyid_matcher'>matcher</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> <span class='kw'>then</span>
891
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
892
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>then</span>
893
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
894
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span>
895
+ <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>?</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
896
+ <span class='kw'>else</span>
897
+ <span class='kw'>nil</span>
898
+ <span class='kw'>end</span>
899
+ <span class='kw'>end</span>
900
+ <span class='kw'>end</span></pre>
901
+ </td>
902
+ </tr>
903
+ </table>
904
+ </div>
905
+
906
+ </div>
907
+
908
+
909
+ <div id="instance_method_details" class="method_details_list">
910
+ <h2>Instance Method Details</h2>
911
+
912
+
913
+ <div class="method_details first">
914
+ <h3 class="signature first" id="match-instance_method">
915
+
916
+ - (<tt>Object|NilClass</tt>) <strong>match</strong>(type, *args)
917
+
918
+
919
+
920
+
921
+
922
+ </h3><div class="docstring">
923
+ <div class="discussion">
924
+ <p>Performs a match of this definition.</p>
925
+
926
+
927
+ </div>
928
+ </div>
929
+ <div class="tags">
930
+ <p class="tag_title">Parameters:</p>
931
+ <ul class="param">
932
+
933
+ <li>
934
+
935
+ <span class='name'>type</span>
936
+
937
+
938
+ <span class='type'>(<tt>Symbol</tt>)</span>
939
+
940
+
941
+
942
+ &mdash;
943
+ <div class='inline'><p>The matcher to perform. Can be <code>:primary</code> (default) or <code>:secondary</code>.</p>
944
+ </div>
945
+
946
+ </li>
947
+
948
+ <li>
949
+
950
+ <span class='name'>args</span>
951
+
952
+
953
+ <span class='type'>(<tt>Array</tt>)</span>
954
+
955
+
956
+
957
+ &mdash;
958
+ <div class='inline'><p>Arguments to pass to the matcher. The first is the definition itself.</p>
959
+ </div>
960
+
961
+ </li>
962
+
963
+ </ul>
964
+
965
+ <p class="tag_title">Returns:</p>
966
+ <ul class="return">
967
+
968
+ <li>
969
+
970
+
971
+ <span class='type'>(<tt>Object|NilClass</tt>)</span>
972
+
973
+
974
+
975
+ &mdash;
976
+ <div class='inline'><p>A match if matcher succeeded, <code>nil</code> otherwise.</p>
977
+ </div>
978
+
979
+ </li>
980
+
981
+ </ul>
982
+
983
+ </div><table class="source_code">
984
+ <tr>
985
+ <td>
986
+ <pre class="lines">
987
+
988
+
989
+ 40
990
+ 41
991
+ 42
992
+ 43
993
+ 44
994
+ 45
995
+ 46
996
+ 47
997
+ 48
998
+ 49
999
+ 50
1000
+ 51
1001
+ 52</pre>
1002
+ </td>
1003
+ <td>
1004
+ <pre class="code"><span class="info file"># File 'lib/brauser/definition.rb', line 40</span>
1005
+
1006
+ <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1007
+ <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>||</span> <span class='symbol'>:primary</span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
1008
+
1009
+ <span class='kw'>if</span> <span class='id identifier rubyid_matcher'>matcher</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> <span class='kw'>then</span>
1010
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
1011
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:call</span><span class='rparen'>)</span> <span class='kw'>then</span>
1012
+ <span class='id identifier rubyid_matcher'>matcher</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1013
+ <span class='kw'>elsif</span> <span class='id identifier rubyid_matcher'>matcher</span>
1014
+ <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_matcher'>matcher</span> <span class='op'>?</span> <span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
1015
+ <span class='kw'>else</span>
1016
+ <span class='kw'>nil</span>
1017
+ <span class='kw'>end</span>
1018
+ <span class='kw'>end</span></pre>
1019
+ </td>
1020
+ </tr>
1021
+ </table>
1022
+ </div>
1023
+
1024
+ </div>
1025
+
1026
+ </div>
1027
+
1028
+ <div id="footer">
1029
+ Generated on Sun May 19 15:39:14 2013 by
1030
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1031
+ 0.8.6.1 (ruby-1.9.3).
1032
+ </div>
1033
+
1034
+ </body>
1035
+ </html>