brauser 4.1.2 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.rubocop.yml +6 -1
- data/.travis-gemfile +2 -2
- data/.travis.yml +5 -3
- data/.yardopts +1 -1
- data/Gemfile +1 -1
- data/LICENSE.md +21 -0
- data/README.md +20 -22
- data/Rakefile +1 -1
- data/brauser.gemspec +2 -2
- data/default_definitions/browsers.rb +1 -1
- data/default_definitions/languages.rb +1 -1
- data/default_definitions/platforms.rb +1 -1
- data/{doc → docs}/Brauser.html +1 -1
- data/docs/Brauser/Browser.html +5542 -0
- data/{doc → docs}/Brauser/Definitions.html +23 -27
- data/{doc → docs}/Brauser/Definitions/Base.html +14 -16
- data/docs/Brauser/Definitions/Browser.html +1031 -0
- data/{doc → docs}/Brauser/Definitions/Language.html +35 -38
- data/{doc → docs}/Brauser/Definitions/Platform.html +67 -71
- data/{doc → docs}/Brauser/Hooks.html +1 -1
- data/{doc → docs}/Brauser/Hooks/RubyOnRails.html +8 -10
- data/{doc → docs}/Brauser/Parser.html +22 -25
- data/{doc → docs}/Brauser/Value.html +38 -42
- data/{doc → docs}/Brauser/Version.html +5 -9
- data/{doc → docs}/_index.html +1 -1
- data/{doc → docs}/class_list.html +0 -0
- data/{doc → docs}/css/common.css +0 -0
- data/{doc → docs}/css/full_list.css +0 -0
- data/{doc → docs}/css/style.css +0 -0
- data/{doc → docs}/file.README.html +9 -7
- data/{doc → docs}/file_list.html +0 -0
- data/{doc → docs}/frames.html +0 -0
- data/{doc → docs}/index.html +9 -7
- data/{doc → docs}/js/app.js +0 -0
- data/{doc → docs}/js/full_list.js +0 -0
- data/{doc → docs}/js/jquery.js +0 -0
- data/{doc → docs}/method_list.html +0 -0
- data/{doc → docs}/top-level-namespace.html +1 -1
- data/lib/brauser.rb +1 -1
- data/lib/brauser/browser.rb +1 -1
- data/lib/brauser/definitions/base.rb +1 -1
- data/lib/brauser/definitions/browser.rb +1 -1
- data/lib/brauser/definitions/language.rb +1 -1
- data/lib/brauser/definitions/platform.rb +1 -1
- data/lib/brauser/hooks.rb +1 -1
- data/lib/brauser/parser.rb +1 -1
- data/lib/brauser/value.rb +1 -1
- data/lib/brauser/version.rb +2 -2
- data/spec/brauser/browser_spec.rb +1 -1
- data/spec/brauser/default_definitions_spec.rb +1 -1
- data/spec/brauser/definitions/base_spec.rb +1 -1
- data/spec/brauser/definitions/browser_spec.rb +1 -1
- data/spec/brauser/definitions/language_spec.rb +1 -1
- data/spec/brauser/definitions/platform_spec.rb +1 -1
- data/spec/brauser/hooks_spec.rb +1 -1
- data/spec/brauser/parser_spec.rb +1 -1
- data/spec/brauser/value_spec.rb +1 -1
- data/spec/coverage_helper.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +30 -46
- data/doc/Brauser/Browseable.html +0 -127
- data/doc/Brauser/Browseable/Attributes.html +0 -489
- data/doc/Brauser/Browseable/DefaultDefinitions.html +0 -389
- data/doc/Brauser/Browseable/General.html +0 -134
- data/doc/Brauser/Browseable/General/ClassMethods.html +0 -529
- data/doc/Brauser/Browseable/Parsing.html +0 -350
- data/doc/Brauser/Browseable/PartialQuerying.html +0 -625
- data/doc/Brauser/Browseable/Querying.html +0 -694
- data/doc/Brauser/Browseable/Register.html +0 -134
- data/doc/Brauser/Browseable/Register/ClassMethods.html +0 -516
- data/doc/Brauser/Browser.html +0 -5557
- data/doc/Brauser/Definition.html +0 -1235
- data/doc/Brauser/Definitions/Browser.html +0 -1036
- data/doc/Brauser/Query.html +0 -512
- data/doc/Brauser/Queryable.html +0 -127
- data/doc/Brauser/Queryable/Chainers.html +0 -598
- data/doc/Brauser/Queryable/Queries.html +0 -598
@@ -273,10 +273,9 @@
|
|
273
273
|
<td>
|
274
274
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 34</span>
|
275
275
|
|
276
|
-
<span class='
|
277
|
-
<span class='
|
278
|
-
<span class='
|
279
|
-
</pre>
|
276
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_browsers'>browsers</span>
|
277
|
+
<span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='symbol'>:browsers</span><span class='rbracket'>]</span>
|
278
|
+
<span class='kw'>end</span></pre>
|
280
279
|
</td>
|
281
280
|
</tr>
|
282
281
|
</table>
|
@@ -333,10 +332,9 @@
|
|
333
332
|
<td>
|
334
333
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 52</span>
|
335
334
|
|
336
|
-
<span class='
|
337
|
-
<span class='
|
338
|
-
<span class='
|
339
|
-
</pre>
|
335
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_languages'>languages</span>
|
336
|
+
<span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='symbol'>:languages</span><span class='rbracket'>]</span>
|
337
|
+
<span class='kw'>end</span></pre>
|
340
338
|
</td>
|
341
339
|
</tr>
|
342
340
|
</table>
|
@@ -393,10 +391,9 @@
|
|
393
391
|
<td>
|
394
392
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 43</span>
|
395
393
|
|
396
|
-
<span class='
|
397
|
-
<span class='
|
398
|
-
<span class='
|
399
|
-
</pre>
|
394
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_platforms'>platforms</span>
|
395
|
+
<span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='symbol'>:platforms</span><span class='rbracket'>]</span>
|
396
|
+
<span class='kw'>end</span></pre>
|
400
397
|
</td>
|
401
398
|
</tr>
|
402
399
|
</table>
|
@@ -508,20 +505,19 @@
|
|
508
505
|
<td>
|
509
506
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 15</span>
|
510
507
|
|
511
|
-
<span class='
|
512
|
-
<span class='
|
513
|
-
<span class='
|
514
|
-
<span class='
|
515
|
-
<span class='
|
516
|
-
<span class='
|
517
|
-
<span class='
|
518
|
-
<span class='
|
519
|
-
|
520
|
-
<span class='
|
521
|
-
<span class='
|
522
|
-
<span class='
|
523
|
-
<span class='
|
524
|
-
</pre>
|
508
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_register'>register</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='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
509
|
+
<span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span>
|
510
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
|
511
|
+
<span class='kw'>when</span> <span class='symbol'>:browser</span> <span class='kw'>then</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='op'>::</span><span class='const'>Browser</span>
|
512
|
+
<span class='kw'>when</span> <span class='symbol'>:language</span> <span class='kw'>then</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='op'>::</span><span class='const'>Language</span>
|
513
|
+
<span class='kw'>when</span> <span class='symbol'>:platform</span> <span class='kw'>then</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='op'>::</span><span class='const'>Platform</span>
|
514
|
+
<span class='kw'>else</span> <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid definition type \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>\".</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
515
|
+
<span class='kw'>end</span>
|
516
|
+
|
517
|
+
<span class='ivar'>@definitions</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='label'>browsers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>languages:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>platforms:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rbrace'>}</span>
|
518
|
+
<span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_kwargs'>kwargs</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
519
|
+
<span class='ivar'>@definitions</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>s</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_definition'>definition</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_definition'>definition</span>
|
520
|
+
<span class='kw'>end</span></pre>
|
525
521
|
</td>
|
526
522
|
</tr>
|
527
523
|
</table>
|
@@ -532,7 +528,7 @@
|
|
532
528
|
</div>
|
533
529
|
|
534
530
|
<div id="footer">
|
535
|
-
Generated on
|
531
|
+
Generated on Thu Aug 18 15:49:54 2016 by
|
536
532
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
537
533
|
0.8.7.6 (ruby-2.3.0).
|
538
534
|
</div>
|
@@ -249,17 +249,16 @@
|
|
249
249
|
<td>
|
250
250
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 60</span>
|
251
251
|
|
252
|
-
<span class='
|
253
|
-
<span class='
|
254
|
-
|
255
|
-
<span class='comment
|
256
|
-
<span class='comment
|
257
|
-
<span class='comment
|
258
|
-
<span class='
|
259
|
-
<span class='
|
260
|
-
<span class='
|
261
|
-
<span class='
|
262
|
-
</pre>
|
252
|
+
<span class='kw'>class</span> <span class='const'>Base</span>
|
253
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:id</span>
|
254
|
+
|
255
|
+
<span class='comment'># Performs a match of this definition.
|
256
|
+
</span> <span class='comment'>#
|
257
|
+
</span> <span class='comment'># @return [Object|NilClass] A non falsy value if match succeeded, `false` or `nil` otherwise.
|
258
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid__'>_</span><span class='rparen'>)</span>
|
259
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Must be overridden by a subclass.</span><span class='tstring_end'>"</span></span>
|
260
|
+
<span class='kw'>end</span>
|
261
|
+
<span class='kw'>end</span></pre>
|
263
262
|
</td>
|
264
263
|
</tr>
|
265
264
|
</table>
|
@@ -321,10 +320,9 @@
|
|
321
320
|
<td>
|
322
321
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 66</span>
|
323
322
|
|
324
|
-
<span class='
|
325
|
-
<span class='
|
326
|
-
<span class='
|
327
|
-
</pre>
|
323
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid__'>_</span><span class='rparen'>)</span>
|
324
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Must be overridden by a subclass.</span><span class='tstring_end'>"</span></span>
|
325
|
+
<span class='kw'>end</span></pre>
|
328
326
|
</td>
|
329
327
|
</tr>
|
330
328
|
</table>
|
@@ -335,7 +333,7 @@
|
|
335
333
|
</div>
|
336
334
|
|
337
335
|
<div id="footer">
|
338
|
-
Generated on
|
336
|
+
Generated on Thu Aug 18 15:49:54 2016 by
|
339
337
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
340
338
|
0.8.7.6 (ruby-2.3.0).
|
341
339
|
</div>
|
@@ -0,0 +1,1031 @@
|
|
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::Definitions::Browser
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
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#!Brauser/Definitions/Browser.html";
|
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 (B)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Brauser.html" title="Brauser (module)">Brauser</a></span></span> » <span class='title'><span class='object_link'><a href="../Definitions.html" title="Brauser::Definitions (module)">Definitions</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Browser</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::Definitions::Browser
|
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"><span class='object_link'><a href="Base.html" title="Brauser::Definitions::Base (class)">Base</a></span></span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next"><span class='object_link'><a href="Base.html" title="Brauser::Definitions::Base (class)">Base</a></span></li>
|
82
|
+
|
83
|
+
<li class="next">Brauser::Definitions::Browser</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/brauser/definitions/browser.rb</dd>
|
100
|
+
|
101
|
+
</dl>
|
102
|
+
<div class="clear"></div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
<p>A definition of a platform.</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
119
|
+
<ul class="summary">
|
120
|
+
|
121
|
+
<li class="public ">
|
122
|
+
<span class="summary_signature">
|
123
|
+
|
124
|
+
<a href="#engine_matcher-instance_method" title="#engine_matcher (instance method)">- (Regexp|Proc) <strong>engine_matcher</strong> </a>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</span>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="note title readonly">readonly</span>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'><p>The pattern or the block to recognize the engine.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#name-instance_method" title="#name (instance method)">- (String) <strong>name</strong> </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="note title readonly">readonly</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'><p>The platform name.</p>
|
172
|
+
</div></span>
|
173
|
+
|
174
|
+
</li>
|
175
|
+
|
176
|
+
|
177
|
+
<li class="public ">
|
178
|
+
<span class="summary_signature">
|
179
|
+
|
180
|
+
<a href="#version_matcher-instance_method" title="#version_matcher (instance method)">- (Regexp|Proc) <strong>version_matcher</strong> </a>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</span>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="note title readonly">readonly</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<span class="summary_desc"><div class='inline'><p>The pattern or the block to recognize the version.</p>
|
200
|
+
</div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
</ul>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Base.html" title="Brauser::Definitions::Base (class)">Base</a></span></h3>
|
212
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#id-instance_method" title="Brauser::Definitions::Base#id (method)">#id</a></span></p>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
<h2>
|
217
|
+
Instance Method Summary
|
218
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
219
|
+
</h2>
|
220
|
+
|
221
|
+
<ul class="summary">
|
222
|
+
|
223
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Browser) <strong>initialize</strong>(id, name, engine_matcher, version_matcher, **_) </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
<span class="note title constructor">constructor</span>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new definition.</p>
|
243
|
+
</div></span>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
|
248
|
+
<li class="public ">
|
249
|
+
<span class="summary_signature">
|
250
|
+
|
251
|
+
<a href="#match-instance_method" title="#match (instance method)">- (Array|NilClass) <strong>match</strong>(header) </a>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
</span>
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<span class="summary_desc"><div class='inline'><p>Matches against an header.</p>
|
266
|
+
</div></span>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
|
271
|
+
</ul>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
<div id="constructor_details" class="method_details_list">
|
281
|
+
<h2>Constructor Details</h2>
|
282
|
+
|
283
|
+
<div class="method_details first">
|
284
|
+
<h3 class="signature first" id="initialize-instance_method">
|
285
|
+
|
286
|
+
- (<tt><span class='object_link'><a href="" title="Brauser::Definitions::Browser (class)">Browser</a></span></tt>) <strong>initialize</strong>(id, name, engine_matcher, version_matcher, **_)
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
</h3><div class="docstring">
|
293
|
+
<div class="discussion">
|
294
|
+
<p>Creates a new definition.</p>
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
<div class="tags">
|
300
|
+
<p class="tag_title">Parameters:</p>
|
301
|
+
<ul class="param">
|
302
|
+
|
303
|
+
<li>
|
304
|
+
|
305
|
+
<span class='name'>id</span>
|
306
|
+
|
307
|
+
|
308
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
—
|
313
|
+
<div class='inline'><p>The platform id.</p>
|
314
|
+
</div>
|
315
|
+
|
316
|
+
</li>
|
317
|
+
|
318
|
+
<li>
|
319
|
+
|
320
|
+
<span class='name'>name</span>
|
321
|
+
|
322
|
+
|
323
|
+
<span class='type'>(<tt>String</tt>)</span>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
—
|
328
|
+
<div class='inline'><p>The platform name.</p>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
</li>
|
332
|
+
|
333
|
+
<li>
|
334
|
+
|
335
|
+
<span class='name'>engine_matcher</span>
|
336
|
+
|
337
|
+
|
338
|
+
<span class='type'>(<tt>Regexp|Proc</tt>)</span>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
—
|
343
|
+
<div class='inline'><p>The pattern or the block to recognize the engine.</p>
|
344
|
+
</div>
|
345
|
+
|
346
|
+
</li>
|
347
|
+
|
348
|
+
<li>
|
349
|
+
|
350
|
+
<span class='name'>version_matcher</span>
|
351
|
+
|
352
|
+
|
353
|
+
<span class='type'>(<tt>Regexp|Proc</tt>)</span>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
—
|
358
|
+
<div class='inline'><p>The pattern or the block to recognize the version.</p>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
</li>
|
362
|
+
|
363
|
+
</ul>
|
364
|
+
|
365
|
+
|
366
|
+
</div><table class="source_code">
|
367
|
+
<tr>
|
368
|
+
<td>
|
369
|
+
<pre class="lines">
|
370
|
+
|
371
|
+
|
372
|
+
25
|
373
|
+
26
|
374
|
+
27
|
375
|
+
28
|
376
|
+
29
|
377
|
+
30</pre>
|
378
|
+
</td>
|
379
|
+
<td>
|
380
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 25</span>
|
381
|
+
|
382
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid__'>_</span><span class='rparen'>)</span>
|
383
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
384
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
385
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
386
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
387
|
+
<span class='kw'>end</span></pre>
|
388
|
+
</td>
|
389
|
+
</tr>
|
390
|
+
</table>
|
391
|
+
</div>
|
392
|
+
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div id="instance_attr_details" class="attr_details">
|
396
|
+
<h2>Instance Attribute Details</h2>
|
397
|
+
|
398
|
+
|
399
|
+
<span id=""></span>
|
400
|
+
<div class="method_details first">
|
401
|
+
<h3 class="signature first" id="engine_matcher-instance_method">
|
402
|
+
|
403
|
+
- (<tt>Regexp|Proc</tt>) <strong>engine_matcher</strong> <span class="extras">(readonly)</span>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
</h3><div class="docstring">
|
410
|
+
<div class="discussion">
|
411
|
+
<p>Returns The pattern or the block to recognize the engine.</p>
|
412
|
+
|
413
|
+
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
<div class="tags">
|
417
|
+
|
418
|
+
<p class="tag_title">Returns:</p>
|
419
|
+
<ul class="return">
|
420
|
+
|
421
|
+
<li>
|
422
|
+
|
423
|
+
|
424
|
+
<span class='type'>(<tt>Regexp|Proc</tt>)</span>
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
—
|
429
|
+
<div class='inline'><p>The pattern or the block to recognize the engine.</p>
|
430
|
+
</div>
|
431
|
+
|
432
|
+
</li>
|
433
|
+
|
434
|
+
</ul>
|
435
|
+
|
436
|
+
</div><table class="source_code">
|
437
|
+
<tr>
|
438
|
+
<td>
|
439
|
+
<pre class="lines">
|
440
|
+
|
441
|
+
|
442
|
+
16
|
443
|
+
17
|
444
|
+
18
|
445
|
+
19
|
446
|
+
20
|
447
|
+
21
|
448
|
+
22
|
449
|
+
23
|
450
|
+
24
|
451
|
+
25
|
452
|
+
26
|
453
|
+
27
|
454
|
+
28
|
455
|
+
29
|
456
|
+
30
|
457
|
+
31
|
458
|
+
32
|
459
|
+
33
|
460
|
+
34
|
461
|
+
35
|
462
|
+
36
|
463
|
+
37
|
464
|
+
38
|
465
|
+
39
|
466
|
+
40
|
467
|
+
41
|
468
|
+
42
|
469
|
+
43
|
470
|
+
44
|
471
|
+
45
|
472
|
+
46
|
473
|
+
47
|
474
|
+
48
|
475
|
+
49
|
476
|
+
50
|
477
|
+
51
|
478
|
+
52
|
479
|
+
53
|
480
|
+
54
|
481
|
+
55
|
482
|
+
56
|
483
|
+
57
|
484
|
+
58
|
485
|
+
59
|
486
|
+
60
|
487
|
+
61
|
488
|
+
62
|
489
|
+
63
|
490
|
+
64
|
491
|
+
65
|
492
|
+
66
|
493
|
+
67
|
494
|
+
68
|
495
|
+
69
|
496
|
+
70
|
497
|
+
71
|
498
|
+
72
|
499
|
+
73
|
500
|
+
74
|
501
|
+
75
|
502
|
+
76</pre>
|
503
|
+
</td>
|
504
|
+
<td>
|
505
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
506
|
+
|
507
|
+
<span class='kw'>class</span> <span class='const'>Browser</span> <span class='op'><</span> <span class='const'>Base</span>
|
508
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:engine_matcher</span><span class='comma'>,</span> <span class='symbol'>:version_matcher</span>
|
509
|
+
|
510
|
+
<span class='comment'># Creates a new definition.
|
511
|
+
</span> <span class='comment'>#
|
512
|
+
</span> <span class='comment'># @param id [Symbol] The platform id.
|
513
|
+
</span> <span class='comment'># @param name [String] The platform name.
|
514
|
+
</span> <span class='comment'># @param engine_matcher [Regexp|Proc] The pattern or the block to recognize the engine.
|
515
|
+
</span> <span class='comment'># @param version_matcher [Regexp|Proc] The pattern or the block to recognize the version.
|
516
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid__'>_</span><span class='rparen'>)</span>
|
517
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
518
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
519
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
520
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
521
|
+
<span class='kw'>end</span>
|
522
|
+
|
523
|
+
<span class='comment'># Matches against an header.
|
524
|
+
</span> <span class='comment'>#
|
525
|
+
</span> <span class='comment'># @param header [String] The header to match
|
526
|
+
</span> <span class='comment'># @return [Array|NilClass] An array with the engine and the version if match succeeded, `false` or `nil` otherwise.
|
527
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span>
|
528
|
+
<span class='comment'># First of all, match the engine
|
529
|
+
</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@id</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
530
|
+
|
531
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
532
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@version_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
533
|
+
<span class='id identifier rubyid_platform'>platform</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
534
|
+
<span class='lbracket'>[</span><span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
535
|
+
<span class='kw'>end</span>
|
536
|
+
<span class='kw'>end</span>
|
537
|
+
|
538
|
+
<span class='id identifier rubyid_private'>private</span>
|
539
|
+
|
540
|
+
<span class='comment'># :nodoc:
|
541
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
542
|
+
<span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_pattern'>pattern</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Regexp</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='symbol'>:match</span> <span class='op'>:</span> <span class='symbol'>:call</span>
|
543
|
+
<span class='id identifier rubyid_pattern'>pattern</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
544
|
+
<span class='kw'>end</span>
|
545
|
+
|
546
|
+
<span class='comment'># :nodoc:
|
547
|
+
</span> <span class='comment'># @private
|
548
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
549
|
+
<span class='comment'># Adjust version
|
550
|
+
</span> <span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
551
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='kw'>if</span> <span class='id identifier rubyid_version'>version</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'>MatchData</span><span class='rparen'>)</span>
|
552
|
+
<span class='const'>Versionomy</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
553
|
+
<span class='kw'>rescue</span>
|
554
|
+
<span class='id identifier rubyid_version'>version</span>
|
555
|
+
<span class='kw'>end</span>
|
556
|
+
|
557
|
+
<span class='comment'># :nodoc:
|
558
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
559
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
560
|
+
<span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='period'>.</span><span class='id identifier rubyid_platforms'>platforms</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_platform'>platform</span><span class='comma'>,</span> <span class='id identifier rubyid_definition'>definition</span><span class='op'>|</span>
|
561
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='comma'>,</span> <span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_definition'>definition</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
562
|
+
<span class='kw'>end</span>
|
563
|
+
|
564
|
+
<span class='kw'>nil</span>
|
565
|
+
<span class='kw'>end</span>
|
566
|
+
<span class='kw'>end</span>
|
567
|
+
<span class='kw'>end</span></pre>
|
568
|
+
</td>
|
569
|
+
</tr>
|
570
|
+
</table>
|
571
|
+
</div>
|
572
|
+
|
573
|
+
|
574
|
+
<span id=""></span>
|
575
|
+
<div class="method_details ">
|
576
|
+
<h3 class="signature " id="name-instance_method">
|
577
|
+
|
578
|
+
- (<tt>String</tt>) <strong>name</strong> <span class="extras">(readonly)</span>
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
</h3><div class="docstring">
|
585
|
+
<div class="discussion">
|
586
|
+
<p>Returns The platform name.</p>
|
587
|
+
|
588
|
+
|
589
|
+
</div>
|
590
|
+
</div>
|
591
|
+
<div class="tags">
|
592
|
+
|
593
|
+
<p class="tag_title">Returns:</p>
|
594
|
+
<ul class="return">
|
595
|
+
|
596
|
+
<li>
|
597
|
+
|
598
|
+
|
599
|
+
<span class='type'>(<tt>String</tt>)</span>
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
—
|
604
|
+
<div class='inline'><p>The platform name.</p>
|
605
|
+
</div>
|
606
|
+
|
607
|
+
</li>
|
608
|
+
|
609
|
+
</ul>
|
610
|
+
|
611
|
+
</div><table class="source_code">
|
612
|
+
<tr>
|
613
|
+
<td>
|
614
|
+
<pre class="lines">
|
615
|
+
|
616
|
+
|
617
|
+
16
|
618
|
+
17
|
619
|
+
18
|
620
|
+
19
|
621
|
+
20
|
622
|
+
21
|
623
|
+
22
|
624
|
+
23
|
625
|
+
24
|
626
|
+
25
|
627
|
+
26
|
628
|
+
27
|
629
|
+
28
|
630
|
+
29
|
631
|
+
30
|
632
|
+
31
|
633
|
+
32
|
634
|
+
33
|
635
|
+
34
|
636
|
+
35
|
637
|
+
36
|
638
|
+
37
|
639
|
+
38
|
640
|
+
39
|
641
|
+
40
|
642
|
+
41
|
643
|
+
42
|
644
|
+
43
|
645
|
+
44
|
646
|
+
45
|
647
|
+
46
|
648
|
+
47
|
649
|
+
48
|
650
|
+
49
|
651
|
+
50
|
652
|
+
51
|
653
|
+
52
|
654
|
+
53
|
655
|
+
54
|
656
|
+
55
|
657
|
+
56
|
658
|
+
57
|
659
|
+
58
|
660
|
+
59
|
661
|
+
60
|
662
|
+
61
|
663
|
+
62
|
664
|
+
63
|
665
|
+
64
|
666
|
+
65
|
667
|
+
66
|
668
|
+
67
|
669
|
+
68
|
670
|
+
69
|
671
|
+
70
|
672
|
+
71
|
673
|
+
72
|
674
|
+
73
|
675
|
+
74
|
676
|
+
75
|
677
|
+
76</pre>
|
678
|
+
</td>
|
679
|
+
<td>
|
680
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
681
|
+
|
682
|
+
<span class='kw'>class</span> <span class='const'>Browser</span> <span class='op'><</span> <span class='const'>Base</span>
|
683
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:engine_matcher</span><span class='comma'>,</span> <span class='symbol'>:version_matcher</span>
|
684
|
+
|
685
|
+
<span class='comment'># Creates a new definition.
|
686
|
+
</span> <span class='comment'>#
|
687
|
+
</span> <span class='comment'># @param id [Symbol] The platform id.
|
688
|
+
</span> <span class='comment'># @param name [String] The platform name.
|
689
|
+
</span> <span class='comment'># @param engine_matcher [Regexp|Proc] The pattern or the block to recognize the engine.
|
690
|
+
</span> <span class='comment'># @param version_matcher [Regexp|Proc] The pattern or the block to recognize the version.
|
691
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid__'>_</span><span class='rparen'>)</span>
|
692
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
693
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
694
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
695
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
696
|
+
<span class='kw'>end</span>
|
697
|
+
|
698
|
+
<span class='comment'># Matches against an header.
|
699
|
+
</span> <span class='comment'>#
|
700
|
+
</span> <span class='comment'># @param header [String] The header to match
|
701
|
+
</span> <span class='comment'># @return [Array|NilClass] An array with the engine and the version if match succeeded, `false` or `nil` otherwise.
|
702
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span>
|
703
|
+
<span class='comment'># First of all, match the engine
|
704
|
+
</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@id</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
705
|
+
|
706
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
707
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@version_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
708
|
+
<span class='id identifier rubyid_platform'>platform</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
709
|
+
<span class='lbracket'>[</span><span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
710
|
+
<span class='kw'>end</span>
|
711
|
+
<span class='kw'>end</span>
|
712
|
+
|
713
|
+
<span class='id identifier rubyid_private'>private</span>
|
714
|
+
|
715
|
+
<span class='comment'># :nodoc:
|
716
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
717
|
+
<span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_pattern'>pattern</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Regexp</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='symbol'>:match</span> <span class='op'>:</span> <span class='symbol'>:call</span>
|
718
|
+
<span class='id identifier rubyid_pattern'>pattern</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
719
|
+
<span class='kw'>end</span>
|
720
|
+
|
721
|
+
<span class='comment'># :nodoc:
|
722
|
+
</span> <span class='comment'># @private
|
723
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
724
|
+
<span class='comment'># Adjust version
|
725
|
+
</span> <span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
726
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='kw'>if</span> <span class='id identifier rubyid_version'>version</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'>MatchData</span><span class='rparen'>)</span>
|
727
|
+
<span class='const'>Versionomy</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
728
|
+
<span class='kw'>rescue</span>
|
729
|
+
<span class='id identifier rubyid_version'>version</span>
|
730
|
+
<span class='kw'>end</span>
|
731
|
+
|
732
|
+
<span class='comment'># :nodoc:
|
733
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
734
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
735
|
+
<span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='period'>.</span><span class='id identifier rubyid_platforms'>platforms</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_platform'>platform</span><span class='comma'>,</span> <span class='id identifier rubyid_definition'>definition</span><span class='op'>|</span>
|
736
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='comma'>,</span> <span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_definition'>definition</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
737
|
+
<span class='kw'>end</span>
|
738
|
+
|
739
|
+
<span class='kw'>nil</span>
|
740
|
+
<span class='kw'>end</span>
|
741
|
+
<span class='kw'>end</span>
|
742
|
+
<span class='kw'>end</span></pre>
|
743
|
+
</td>
|
744
|
+
</tr>
|
745
|
+
</table>
|
746
|
+
</div>
|
747
|
+
|
748
|
+
|
749
|
+
<span id=""></span>
|
750
|
+
<div class="method_details ">
|
751
|
+
<h3 class="signature " id="version_matcher-instance_method">
|
752
|
+
|
753
|
+
- (<tt>Regexp|Proc</tt>) <strong>version_matcher</strong> <span class="extras">(readonly)</span>
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
</h3><div class="docstring">
|
760
|
+
<div class="discussion">
|
761
|
+
<p>Returns The pattern or the block to recognize the version.</p>
|
762
|
+
|
763
|
+
|
764
|
+
</div>
|
765
|
+
</div>
|
766
|
+
<div class="tags">
|
767
|
+
|
768
|
+
<p class="tag_title">Returns:</p>
|
769
|
+
<ul class="return">
|
770
|
+
|
771
|
+
<li>
|
772
|
+
|
773
|
+
|
774
|
+
<span class='type'>(<tt>Regexp|Proc</tt>)</span>
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
—
|
779
|
+
<div class='inline'><p>The pattern or the block to recognize the version.</p>
|
780
|
+
</div>
|
781
|
+
|
782
|
+
</li>
|
783
|
+
|
784
|
+
</ul>
|
785
|
+
|
786
|
+
</div><table class="source_code">
|
787
|
+
<tr>
|
788
|
+
<td>
|
789
|
+
<pre class="lines">
|
790
|
+
|
791
|
+
|
792
|
+
16
|
793
|
+
17
|
794
|
+
18
|
795
|
+
19
|
796
|
+
20
|
797
|
+
21
|
798
|
+
22
|
799
|
+
23
|
800
|
+
24
|
801
|
+
25
|
802
|
+
26
|
803
|
+
27
|
804
|
+
28
|
805
|
+
29
|
806
|
+
30
|
807
|
+
31
|
808
|
+
32
|
809
|
+
33
|
810
|
+
34
|
811
|
+
35
|
812
|
+
36
|
813
|
+
37
|
814
|
+
38
|
815
|
+
39
|
816
|
+
40
|
817
|
+
41
|
818
|
+
42
|
819
|
+
43
|
820
|
+
44
|
821
|
+
45
|
822
|
+
46
|
823
|
+
47
|
824
|
+
48
|
825
|
+
49
|
826
|
+
50
|
827
|
+
51
|
828
|
+
52
|
829
|
+
53
|
830
|
+
54
|
831
|
+
55
|
832
|
+
56
|
833
|
+
57
|
834
|
+
58
|
835
|
+
59
|
836
|
+
60
|
837
|
+
61
|
838
|
+
62
|
839
|
+
63
|
840
|
+
64
|
841
|
+
65
|
842
|
+
66
|
843
|
+
67
|
844
|
+
68
|
845
|
+
69
|
846
|
+
70
|
847
|
+
71
|
848
|
+
72
|
849
|
+
73
|
850
|
+
74
|
851
|
+
75
|
852
|
+
76</pre>
|
853
|
+
</td>
|
854
|
+
<td>
|
855
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
856
|
+
|
857
|
+
<span class='kw'>class</span> <span class='const'>Browser</span> <span class='op'><</span> <span class='const'>Base</span>
|
858
|
+
<span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:engine_matcher</span><span class='comma'>,</span> <span class='symbol'>:version_matcher</span>
|
859
|
+
|
860
|
+
<span class='comment'># Creates a new definition.
|
861
|
+
</span> <span class='comment'>#
|
862
|
+
</span> <span class='comment'># @param id [Symbol] The platform id.
|
863
|
+
</span> <span class='comment'># @param name [String] The platform name.
|
864
|
+
</span> <span class='comment'># @param engine_matcher [Regexp|Proc] The pattern or the block to recognize the engine.
|
865
|
+
</span> <span class='comment'># @param version_matcher [Regexp|Proc] The pattern or the block to recognize the version.
|
866
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid__'>_</span><span class='rparen'>)</span>
|
867
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
868
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
869
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
870
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
871
|
+
<span class='kw'>end</span>
|
872
|
+
|
873
|
+
<span class='comment'># Matches against an header.
|
874
|
+
</span> <span class='comment'>#
|
875
|
+
</span> <span class='comment'># @param header [String] The header to match
|
876
|
+
</span> <span class='comment'># @return [Array|NilClass] An array with the engine and the version if match succeeded, `false` or `nil` otherwise.
|
877
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span>
|
878
|
+
<span class='comment'># First of all, match the engine
|
879
|
+
</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@id</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
880
|
+
|
881
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
882
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@version_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
883
|
+
<span class='id identifier rubyid_platform'>platform</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
884
|
+
<span class='lbracket'>[</span><span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
885
|
+
<span class='kw'>end</span>
|
886
|
+
<span class='kw'>end</span>
|
887
|
+
|
888
|
+
<span class='id identifier rubyid_private'>private</span>
|
889
|
+
|
890
|
+
<span class='comment'># :nodoc:
|
891
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
892
|
+
<span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='id identifier rubyid_pattern'>pattern</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Regexp</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='symbol'>:match</span> <span class='op'>:</span> <span class='symbol'>:call</span>
|
893
|
+
<span class='id identifier rubyid_pattern'>pattern</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='id identifier rubyid_subject'>subject</span><span class='rparen'>)</span>
|
894
|
+
<span class='kw'>end</span>
|
895
|
+
|
896
|
+
<span class='comment'># :nodoc:
|
897
|
+
</span> <span class='comment'># @private
|
898
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
899
|
+
<span class='comment'># Adjust version
|
900
|
+
</span> <span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
901
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_version'>version</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span> <span class='kw'>if</span> <span class='id identifier rubyid_version'>version</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'>MatchData</span><span class='rparen'>)</span>
|
902
|
+
<span class='const'>Versionomy</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span>
|
903
|
+
<span class='kw'>rescue</span>
|
904
|
+
<span class='id identifier rubyid_version'>version</span>
|
905
|
+
<span class='kw'>end</span>
|
906
|
+
|
907
|
+
<span class='comment'># :nodoc:
|
908
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
909
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
910
|
+
<span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Definitions</span><span class='period'>.</span><span class='id identifier rubyid_platforms'>platforms</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_platform'>platform</span><span class='comma'>,</span> <span class='id identifier rubyid_definition'>definition</span><span class='op'>|</span>
|
911
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='comma'>,</span> <span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_definition'>definition</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
912
|
+
<span class='kw'>end</span>
|
913
|
+
|
914
|
+
<span class='kw'>nil</span>
|
915
|
+
<span class='kw'>end</span>
|
916
|
+
<span class='kw'>end</span>
|
917
|
+
<span class='kw'>end</span></pre>
|
918
|
+
</td>
|
919
|
+
</tr>
|
920
|
+
</table>
|
921
|
+
</div>
|
922
|
+
|
923
|
+
</div>
|
924
|
+
|
925
|
+
|
926
|
+
<div id="instance_method_details" class="method_details_list">
|
927
|
+
<h2>Instance Method Details</h2>
|
928
|
+
|
929
|
+
|
930
|
+
<div class="method_details first">
|
931
|
+
<h3 class="signature first" id="match-instance_method">
|
932
|
+
|
933
|
+
- (<tt>Array|NilClass</tt>) <strong>match</strong>(header)
|
934
|
+
|
935
|
+
|
936
|
+
|
937
|
+
|
938
|
+
|
939
|
+
</h3><div class="docstring">
|
940
|
+
<div class="discussion">
|
941
|
+
<p>Matches against an header.</p>
|
942
|
+
|
943
|
+
|
944
|
+
</div>
|
945
|
+
</div>
|
946
|
+
<div class="tags">
|
947
|
+
<p class="tag_title">Parameters:</p>
|
948
|
+
<ul class="param">
|
949
|
+
|
950
|
+
<li>
|
951
|
+
|
952
|
+
<span class='name'>header</span>
|
953
|
+
|
954
|
+
|
955
|
+
<span class='type'>(<tt>String</tt>)</span>
|
956
|
+
|
957
|
+
|
958
|
+
|
959
|
+
—
|
960
|
+
<div class='inline'><p>The header to match</p>
|
961
|
+
</div>
|
962
|
+
|
963
|
+
</li>
|
964
|
+
|
965
|
+
</ul>
|
966
|
+
|
967
|
+
<p class="tag_title">Returns:</p>
|
968
|
+
<ul class="return">
|
969
|
+
|
970
|
+
<li>
|
971
|
+
|
972
|
+
|
973
|
+
<span class='type'>(<tt>Array|NilClass</tt>)</span>
|
974
|
+
|
975
|
+
|
976
|
+
|
977
|
+
—
|
978
|
+
<div class='inline'><p>An array with the engine and the version if match succeeded, <code>false</code> or <code>nil</code> otherwise.</p>
|
979
|
+
</div>
|
980
|
+
|
981
|
+
</li>
|
982
|
+
|
983
|
+
</ul>
|
984
|
+
|
985
|
+
</div><table class="source_code">
|
986
|
+
<tr>
|
987
|
+
<td>
|
988
|
+
<pre class="lines">
|
989
|
+
|
990
|
+
|
991
|
+
36
|
992
|
+
37
|
993
|
+
38
|
994
|
+
39
|
995
|
+
40
|
996
|
+
41
|
997
|
+
42
|
998
|
+
43
|
999
|
+
44
|
1000
|
+
45</pre>
|
1001
|
+
</td>
|
1002
|
+
<td>
|
1003
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 36</span>
|
1004
|
+
|
1005
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span>
|
1006
|
+
<span class='comment'># First of all, match the engine
|
1007
|
+
</span> <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@engine_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@id</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
1008
|
+
|
1009
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
1010
|
+
<span class='id identifier rubyid_version'>version</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_version'>extract_version</span><span class='lparen'>(</span><span class='id identifier rubyid_perform_match'>perform_match</span><span class='lparen'>(</span><span class='ivar'>@version_matcher</span><span class='comma'>,</span> <span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1011
|
+
<span class='id identifier rubyid_platform'>platform</span> <span class='op'>=</span> <span class='id identifier rubyid_extract_platform'>extract_platform</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span>
|
1012
|
+
<span class='lbracket'>[</span><span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_engine'>engine</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_version'>version</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>Brauser</span><span class='op'>::</span><span class='const'>Value</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
1013
|
+
<span class='kw'>end</span>
|
1014
|
+
<span class='kw'>end</span></pre>
|
1015
|
+
</td>
|
1016
|
+
</tr>
|
1017
|
+
</table>
|
1018
|
+
</div>
|
1019
|
+
|
1020
|
+
</div>
|
1021
|
+
|
1022
|
+
</div>
|
1023
|
+
|
1024
|
+
<div id="footer">
|
1025
|
+
Generated on Thu Aug 18 15:49:54 2016 by
|
1026
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1027
|
+
0.8.7.6 (ruby-2.3.0).
|
1028
|
+
</div>
|
1029
|
+
|
1030
|
+
</body>
|
1031
|
+
</html>
|