brauser 3.3.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/.travis-gemfile +4 -5
- data/.travis.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile +7 -8
- data/README.md +31 -95
- data/Rakefile +0 -1
- data/brauser.gemspec +4 -4
- data/default_definitions/browsers.rb +50 -0
- data/default_definitions/languages.rb +118 -0
- data/default_definitions/platforms.rb +24 -0
- data/doc/Brauser.html +6 -6
- data/doc/Brauser/Browser.html +3867 -580
- data/doc/Brauser/Definitions.html +537 -0
- data/doc/Brauser/Definitions/Base.html +342 -0
- data/doc/Brauser/Definitions/Browser.html +1047 -0
- data/doc/Brauser/Definitions/Language.html +496 -0
- data/doc/Brauser/Definitions/Platform.html +686 -0
- data/doc/Brauser/Hooks.html +2 -2
- data/doc/Brauser/Hooks/RubyOnRails.html +9 -9
- data/doc/Brauser/Parser.html +513 -0
- data/doc/Brauser/Value.html +601 -0
- data/doc/Brauser/Version.html +5 -5
- data/doc/_index.html +25 -108
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +33 -97
- data/doc/index.html +33 -97
- data/doc/method_list.html +72 -120
- data/doc/top-level-namespace.html +2 -2
- data/lib/brauser.rb +13 -15
- data/lib/brauser/browser.rb +195 -66
- data/lib/brauser/definitions/base.rb +71 -0
- data/lib/brauser/definitions/browser.rb +80 -0
- data/lib/brauser/definitions/language.rb +29 -0
- data/lib/brauser/definitions/platform.rb +42 -0
- data/lib/brauser/hooks.rb +1 -2
- data/lib/brauser/parser.rb +47 -0
- data/lib/brauser/value.rb +39 -0
- data/lib/brauser/version.rb +3 -4
- data/spec/brauser/browser_spec.rb +73 -564
- data/spec/brauser/default_definitions_spec.rb +129 -0
- data/spec/brauser/definitions/base_spec.rb +48 -0
- data/spec/brauser/definitions/browser_spec.rb +47 -0
- data/spec/brauser/definitions/language_spec.rb +18 -0
- data/spec/brauser/definitions/platform_spec.rb +36 -0
- data/spec/brauser/hooks_spec.rb +5 -6
- data/spec/brauser/parser_spec.rb +31 -0
- data/spec/brauser/value_spec.rb +34 -0
- data/spec/coverage_helper.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- metadata +50 -23
- data/lib/brauser/browseable/attributes.rb +0 -95
- data/lib/brauser/browseable/general.rb +0 -104
- data/lib/brauser/browseable/parsing.rb +0 -127
- data/lib/brauser/browseable/partial_querying.rb +0 -116
- data/lib/brauser/browseable/querying.rb +0 -63
- data/lib/brauser/browseable/register.rb +0 -73
- data/lib/brauser/definition.rb +0 -80
- data/lib/brauser/definitions/browsers.rb +0 -68
- data/lib/brauser/definitions/languages.rb +0 -130
- data/lib/brauser/definitions/platforms.rb +0 -30
- data/lib/brauser/query.rb +0 -36
- data/lib/brauser/queryable/chainers.rb +0 -56
- data/lib/brauser/queryable/queries.rb +0 -60
- data/spec/brauser/definition_spec.rb +0 -39
- data/spec/brauser/query_spec.rb +0 -111
@@ -0,0 +1,342 @@
|
|
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::Base
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
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/Base.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">Base</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::Base
|
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::Definitions::Base</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/definitions/base.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.</p>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
<div class="tags">
|
110
|
+
|
111
|
+
|
112
|
+
</div><div id="subclasses">
|
113
|
+
<h2>Direct Known Subclasses</h2>
|
114
|
+
<p class="children"><span class='object_link'><a href="Browser.html" title="Brauser::Definitions::Browser (class)">Browser</a></span>, <span class='object_link'><a href="Language.html" title="Brauser::Definitions::Language (class)">Language</a></span>, <span class='object_link'><a href="Platform.html" title="Brauser::Definitions::Platform (class)">Platform</a></span></p>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
121
|
+
<ul class="summary">
|
122
|
+
|
123
|
+
<li class="public ">
|
124
|
+
<span class="summary_signature">
|
125
|
+
|
126
|
+
<a href="#id-instance_method" title="#id (instance method)">- (Object) <strong>id</strong> </a>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
</span>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<span class="note title readonly">readonly</span>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'><p>The id of the definition.</p>
|
146
|
+
</div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
</ul>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<h2>
|
158
|
+
Instance Method Summary
|
159
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
160
|
+
</h2>
|
161
|
+
|
162
|
+
<ul class="summary">
|
163
|
+
|
164
|
+
<li class="public ">
|
165
|
+
<span class="summary_signature">
|
166
|
+
|
167
|
+
<a href="#match-instance_method" title="#match (instance method)">- (Object|NilClass) <strong>match</strong>(_, *_, **_) </a>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
</span>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<span class="summary_desc"><div class='inline'><p>Performs a match of this definition.</p>
|
182
|
+
</div></span>
|
183
|
+
|
184
|
+
</li>
|
185
|
+
|
186
|
+
|
187
|
+
</ul>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<div id="instance_attr_details" class="attr_details">
|
192
|
+
<h2>Instance Attribute Details</h2>
|
193
|
+
|
194
|
+
|
195
|
+
<span id=""></span>
|
196
|
+
<div class="method_details first">
|
197
|
+
<h3 class="signature first" id="id-instance_method">
|
198
|
+
|
199
|
+
- (<tt>Object</tt>) <strong>id</strong> <span class="extras">(readonly)</span>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</h3><div class="docstring">
|
206
|
+
<div class="discussion">
|
207
|
+
<p>Returns The id of the definition.</p>
|
208
|
+
|
209
|
+
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
<div class="tags">
|
213
|
+
|
214
|
+
<p class="tag_title">Returns:</p>
|
215
|
+
<ul class="return">
|
216
|
+
|
217
|
+
<li>
|
218
|
+
|
219
|
+
|
220
|
+
<span class='type'></span>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<div class='inline'><p>The id of the definition.</p>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
230
|
+
</ul>
|
231
|
+
|
232
|
+
</div><table class="source_code">
|
233
|
+
<tr>
|
234
|
+
<td>
|
235
|
+
<pre class="lines">
|
236
|
+
|
237
|
+
|
238
|
+
60
|
239
|
+
61
|
240
|
+
62
|
241
|
+
63
|
242
|
+
64
|
243
|
+
65
|
244
|
+
66
|
245
|
+
67
|
246
|
+
68
|
247
|
+
69</pre>
|
248
|
+
</td>
|
249
|
+
<td>
|
250
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 60</span>
|
251
|
+
|
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>
|
262
|
+
</td>
|
263
|
+
</tr>
|
264
|
+
</table>
|
265
|
+
</div>
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
<div id="instance_method_details" class="method_details_list">
|
271
|
+
<h2>Instance Method Details</h2>
|
272
|
+
|
273
|
+
|
274
|
+
<div class="method_details first">
|
275
|
+
<h3 class="signature first" id="match-instance_method">
|
276
|
+
|
277
|
+
- (<tt>Object|NilClass</tt>) <strong>match</strong>(_, *_, **_)
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</h3><div class="docstring">
|
284
|
+
<div class="discussion">
|
285
|
+
<p>Performs a match of this definition.</p>
|
286
|
+
|
287
|
+
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
<div class="tags">
|
291
|
+
|
292
|
+
<p class="tag_title">Returns:</p>
|
293
|
+
<ul class="return">
|
294
|
+
|
295
|
+
<li>
|
296
|
+
|
297
|
+
|
298
|
+
<span class='type'>(<tt>Object|NilClass</tt>)</span>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
—
|
303
|
+
<div class='inline'><p>A non falsy value if match succeeded, <code>false</code> or <code>nil</code> otherwise.</p>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
</li>
|
307
|
+
|
308
|
+
</ul>
|
309
|
+
|
310
|
+
</div><table class="source_code">
|
311
|
+
<tr>
|
312
|
+
<td>
|
313
|
+
<pre class="lines">
|
314
|
+
|
315
|
+
|
316
|
+
66
|
317
|
+
67
|
318
|
+
68</pre>
|
319
|
+
</td>
|
320
|
+
<td>
|
321
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/base.rb', line 66</span>
|
322
|
+
|
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>
|
326
|
+
</td>
|
327
|
+
</tr>
|
328
|
+
</table>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
</div>
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
<div id="footer">
|
336
|
+
Generated on Mon Sep 29 16:43:32 2014 by
|
337
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
338
|
+
0.8.7.4 (ruby-2.1.3).
|
339
|
+
</div>
|
340
|
+
|
341
|
+
</body>
|
342
|
+
</html>
|
@@ -0,0 +1,1047 @@
|
|
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.4
|
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
|
503
|
+
77
|
504
|
+
78</pre>
|
505
|
+
</td>
|
506
|
+
<td>
|
507
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
508
|
+
|
509
|
+
<span class='kw'>class</span> <span class='const'>Browser</span> <span class='op'><</span> <span class='const'>Base</span>
|
510
|
+
<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>
|
511
|
+
|
512
|
+
<span class='comment'># Creates a new definition.
|
513
|
+
</span> <span class='comment'>#
|
514
|
+
</span> <span class='comment'># @param id [Symbol] The platform id.
|
515
|
+
</span> <span class='comment'># @param name [String] The platform name.
|
516
|
+
</span> <span class='comment'># @param engine_matcher [Regexp|Proc] The pattern or the block to recognize the engine.
|
517
|
+
</span> <span class='comment'># @param version_matcher [Regexp|Proc] The pattern or the block to recognize the version.
|
518
|
+
</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>
|
519
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
520
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
521
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
522
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
523
|
+
<span class='kw'>end</span>
|
524
|
+
|
525
|
+
<span class='comment'># Matches against an header.
|
526
|
+
</span> <span class='comment'>#
|
527
|
+
</span> <span class='comment'># @param header [String] The header to match
|
528
|
+
</span> <span class='comment'># @return [Array|NilClass] An array with the engine and the version if match succeeded, `false` or `nil` otherwise.
|
529
|
+
</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>
|
530
|
+
<span class='comment'># First of all, match the engine
|
531
|
+
</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>
|
532
|
+
|
533
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
534
|
+
<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>
|
535
|
+
<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>
|
536
|
+
<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>
|
537
|
+
<span class='kw'>else</span>
|
538
|
+
<span class='kw'>nil</span>
|
539
|
+
<span class='kw'>end</span>
|
540
|
+
<span class='kw'>end</span>
|
541
|
+
|
542
|
+
<span class='id identifier rubyid_private'>private</span>
|
543
|
+
|
544
|
+
<span class='comment'># :nodoc:
|
545
|
+
</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>
|
546
|
+
<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>
|
547
|
+
<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>
|
548
|
+
<span class='kw'>end</span>
|
549
|
+
|
550
|
+
<span class='comment'># :nodoc:
|
551
|
+
</span> <span class='comment'># @private
|
552
|
+
</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>
|
553
|
+
<span class='comment'># Adjust version
|
554
|
+
</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>
|
555
|
+
<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>
|
556
|
+
<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>
|
557
|
+
<span class='kw'>rescue</span>
|
558
|
+
<span class='id identifier rubyid_version'>version</span>
|
559
|
+
<span class='kw'>end</span>
|
560
|
+
|
561
|
+
<span class='comment'># :nodoc:
|
562
|
+
</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>
|
563
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
564
|
+
<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>
|
565
|
+
<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>
|
566
|
+
<span class='kw'>end</span>
|
567
|
+
|
568
|
+
<span class='kw'>nil</span>
|
569
|
+
<span class='rbrace'>}</span>
|
570
|
+
<span class='kw'>end</span>
|
571
|
+
<span class='kw'>end</span></pre>
|
572
|
+
</td>
|
573
|
+
</tr>
|
574
|
+
</table>
|
575
|
+
</div>
|
576
|
+
|
577
|
+
|
578
|
+
<span id=""></span>
|
579
|
+
<div class="method_details ">
|
580
|
+
<h3 class="signature " id="name-instance_method">
|
581
|
+
|
582
|
+
- (<tt>String</tt>) <strong>name</strong> <span class="extras">(readonly)</span>
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
</h3><div class="docstring">
|
589
|
+
<div class="discussion">
|
590
|
+
<p>Returns The platform name.</p>
|
591
|
+
|
592
|
+
|
593
|
+
</div>
|
594
|
+
</div>
|
595
|
+
<div class="tags">
|
596
|
+
|
597
|
+
<p class="tag_title">Returns:</p>
|
598
|
+
<ul class="return">
|
599
|
+
|
600
|
+
<li>
|
601
|
+
|
602
|
+
|
603
|
+
<span class='type'>(<tt>String</tt>)</span>
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
—
|
608
|
+
<div class='inline'><p>The platform name.</p>
|
609
|
+
</div>
|
610
|
+
|
611
|
+
</li>
|
612
|
+
|
613
|
+
</ul>
|
614
|
+
|
615
|
+
</div><table class="source_code">
|
616
|
+
<tr>
|
617
|
+
<td>
|
618
|
+
<pre class="lines">
|
619
|
+
|
620
|
+
|
621
|
+
16
|
622
|
+
17
|
623
|
+
18
|
624
|
+
19
|
625
|
+
20
|
626
|
+
21
|
627
|
+
22
|
628
|
+
23
|
629
|
+
24
|
630
|
+
25
|
631
|
+
26
|
632
|
+
27
|
633
|
+
28
|
634
|
+
29
|
635
|
+
30
|
636
|
+
31
|
637
|
+
32
|
638
|
+
33
|
639
|
+
34
|
640
|
+
35
|
641
|
+
36
|
642
|
+
37
|
643
|
+
38
|
644
|
+
39
|
645
|
+
40
|
646
|
+
41
|
647
|
+
42
|
648
|
+
43
|
649
|
+
44
|
650
|
+
45
|
651
|
+
46
|
652
|
+
47
|
653
|
+
48
|
654
|
+
49
|
655
|
+
50
|
656
|
+
51
|
657
|
+
52
|
658
|
+
53
|
659
|
+
54
|
660
|
+
55
|
661
|
+
56
|
662
|
+
57
|
663
|
+
58
|
664
|
+
59
|
665
|
+
60
|
666
|
+
61
|
667
|
+
62
|
668
|
+
63
|
669
|
+
64
|
670
|
+
65
|
671
|
+
66
|
672
|
+
67
|
673
|
+
68
|
674
|
+
69
|
675
|
+
70
|
676
|
+
71
|
677
|
+
72
|
678
|
+
73
|
679
|
+
74
|
680
|
+
75
|
681
|
+
76
|
682
|
+
77
|
683
|
+
78</pre>
|
684
|
+
</td>
|
685
|
+
<td>
|
686
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
687
|
+
|
688
|
+
<span class='kw'>class</span> <span class='const'>Browser</span> <span class='op'><</span> <span class='const'>Base</span>
|
689
|
+
<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>
|
690
|
+
|
691
|
+
<span class='comment'># Creates a new definition.
|
692
|
+
</span> <span class='comment'>#
|
693
|
+
</span> <span class='comment'># @param id [Symbol] The platform id.
|
694
|
+
</span> <span class='comment'># @param name [String] The platform name.
|
695
|
+
</span> <span class='comment'># @param engine_matcher [Regexp|Proc] The pattern or the block to recognize the engine.
|
696
|
+
</span> <span class='comment'># @param version_matcher [Regexp|Proc] The pattern or the block to recognize the version.
|
697
|
+
</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>
|
698
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
699
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
700
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
701
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
702
|
+
<span class='kw'>end</span>
|
703
|
+
|
704
|
+
<span class='comment'># Matches against an header.
|
705
|
+
</span> <span class='comment'>#
|
706
|
+
</span> <span class='comment'># @param header [String] The header to match
|
707
|
+
</span> <span class='comment'># @return [Array|NilClass] An array with the engine and the version if match succeeded, `false` or `nil` otherwise.
|
708
|
+
</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>
|
709
|
+
<span class='comment'># First of all, match the engine
|
710
|
+
</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>
|
711
|
+
|
712
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
713
|
+
<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>
|
714
|
+
<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>
|
715
|
+
<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>
|
716
|
+
<span class='kw'>else</span>
|
717
|
+
<span class='kw'>nil</span>
|
718
|
+
<span class='kw'>end</span>
|
719
|
+
<span class='kw'>end</span>
|
720
|
+
|
721
|
+
<span class='id identifier rubyid_private'>private</span>
|
722
|
+
|
723
|
+
<span class='comment'># :nodoc:
|
724
|
+
</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>
|
725
|
+
<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>
|
726
|
+
<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>
|
727
|
+
<span class='kw'>end</span>
|
728
|
+
|
729
|
+
<span class='comment'># :nodoc:
|
730
|
+
</span> <span class='comment'># @private
|
731
|
+
</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>
|
732
|
+
<span class='comment'># Adjust version
|
733
|
+
</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>
|
734
|
+
<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>
|
735
|
+
<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>
|
736
|
+
<span class='kw'>rescue</span>
|
737
|
+
<span class='id identifier rubyid_version'>version</span>
|
738
|
+
<span class='kw'>end</span>
|
739
|
+
|
740
|
+
<span class='comment'># :nodoc:
|
741
|
+
</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>
|
742
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
743
|
+
<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>
|
744
|
+
<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>
|
745
|
+
<span class='kw'>end</span>
|
746
|
+
|
747
|
+
<span class='kw'>nil</span>
|
748
|
+
<span class='rbrace'>}</span>
|
749
|
+
<span class='kw'>end</span>
|
750
|
+
<span class='kw'>end</span></pre>
|
751
|
+
</td>
|
752
|
+
</tr>
|
753
|
+
</table>
|
754
|
+
</div>
|
755
|
+
|
756
|
+
|
757
|
+
<span id=""></span>
|
758
|
+
<div class="method_details ">
|
759
|
+
<h3 class="signature " id="version_matcher-instance_method">
|
760
|
+
|
761
|
+
- (<tt>Regexp|Proc</tt>) <strong>version_matcher</strong> <span class="extras">(readonly)</span>
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
</h3><div class="docstring">
|
768
|
+
<div class="discussion">
|
769
|
+
<p>Returns The pattern or the block to recognize the version.</p>
|
770
|
+
|
771
|
+
|
772
|
+
</div>
|
773
|
+
</div>
|
774
|
+
<div class="tags">
|
775
|
+
|
776
|
+
<p class="tag_title">Returns:</p>
|
777
|
+
<ul class="return">
|
778
|
+
|
779
|
+
<li>
|
780
|
+
|
781
|
+
|
782
|
+
<span class='type'>(<tt>Regexp|Proc</tt>)</span>
|
783
|
+
|
784
|
+
|
785
|
+
|
786
|
+
—
|
787
|
+
<div class='inline'><p>The pattern or the block to recognize the version.</p>
|
788
|
+
</div>
|
789
|
+
|
790
|
+
</li>
|
791
|
+
|
792
|
+
</ul>
|
793
|
+
|
794
|
+
</div><table class="source_code">
|
795
|
+
<tr>
|
796
|
+
<td>
|
797
|
+
<pre class="lines">
|
798
|
+
|
799
|
+
|
800
|
+
16
|
801
|
+
17
|
802
|
+
18
|
803
|
+
19
|
804
|
+
20
|
805
|
+
21
|
806
|
+
22
|
807
|
+
23
|
808
|
+
24
|
809
|
+
25
|
810
|
+
26
|
811
|
+
27
|
812
|
+
28
|
813
|
+
29
|
814
|
+
30
|
815
|
+
31
|
816
|
+
32
|
817
|
+
33
|
818
|
+
34
|
819
|
+
35
|
820
|
+
36
|
821
|
+
37
|
822
|
+
38
|
823
|
+
39
|
824
|
+
40
|
825
|
+
41
|
826
|
+
42
|
827
|
+
43
|
828
|
+
44
|
829
|
+
45
|
830
|
+
46
|
831
|
+
47
|
832
|
+
48
|
833
|
+
49
|
834
|
+
50
|
835
|
+
51
|
836
|
+
52
|
837
|
+
53
|
838
|
+
54
|
839
|
+
55
|
840
|
+
56
|
841
|
+
57
|
842
|
+
58
|
843
|
+
59
|
844
|
+
60
|
845
|
+
61
|
846
|
+
62
|
847
|
+
63
|
848
|
+
64
|
849
|
+
65
|
850
|
+
66
|
851
|
+
67
|
852
|
+
68
|
853
|
+
69
|
854
|
+
70
|
855
|
+
71
|
856
|
+
72
|
857
|
+
73
|
858
|
+
74
|
859
|
+
75
|
860
|
+
76
|
861
|
+
77
|
862
|
+
78</pre>
|
863
|
+
</td>
|
864
|
+
<td>
|
865
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
866
|
+
|
867
|
+
<span class='kw'>class</span> <span class='const'>Browser</span> <span class='op'><</span> <span class='const'>Base</span>
|
868
|
+
<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>
|
869
|
+
|
870
|
+
<span class='comment'># Creates a new definition.
|
871
|
+
</span> <span class='comment'>#
|
872
|
+
</span> <span class='comment'># @param id [Symbol] The platform id.
|
873
|
+
</span> <span class='comment'># @param name [String] The platform name.
|
874
|
+
</span> <span class='comment'># @param engine_matcher [Regexp|Proc] The pattern or the block to recognize the engine.
|
875
|
+
</span> <span class='comment'># @param version_matcher [Regexp|Proc] The pattern or the block to recognize the version.
|
876
|
+
</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>
|
877
|
+
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
|
878
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
879
|
+
<span class='ivar'>@engine_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_engine_matcher'>engine_matcher</span>
|
880
|
+
<span class='ivar'>@version_matcher</span> <span class='op'>=</span> <span class='id identifier rubyid_version_matcher'>version_matcher</span>
|
881
|
+
<span class='kw'>end</span>
|
882
|
+
|
883
|
+
<span class='comment'># Matches against an header.
|
884
|
+
</span> <span class='comment'>#
|
885
|
+
</span> <span class='comment'># @param header [String] The header to match
|
886
|
+
</span> <span class='comment'># @return [Array|NilClass] An array with the engine and the version if match succeeded, `false` or `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_header'>header</span><span class='rparen'>)</span>
|
888
|
+
<span class='comment'># First of all, match the engine
|
889
|
+
</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>
|
890
|
+
|
891
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
892
|
+
<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>
|
893
|
+
<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>
|
894
|
+
<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>
|
895
|
+
<span class='kw'>else</span>
|
896
|
+
<span class='kw'>nil</span>
|
897
|
+
<span class='kw'>end</span>
|
898
|
+
<span class='kw'>end</span>
|
899
|
+
|
900
|
+
<span class='id identifier rubyid_private'>private</span>
|
901
|
+
|
902
|
+
<span class='comment'># :nodoc:
|
903
|
+
</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>
|
904
|
+
<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>
|
905
|
+
<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>
|
906
|
+
<span class='kw'>end</span>
|
907
|
+
|
908
|
+
<span class='comment'># :nodoc:
|
909
|
+
</span> <span class='comment'># @private
|
910
|
+
</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>
|
911
|
+
<span class='comment'># Adjust version
|
912
|
+
</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>
|
913
|
+
<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>
|
914
|
+
<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>
|
915
|
+
<span class='kw'>rescue</span>
|
916
|
+
<span class='id identifier rubyid_version'>version</span>
|
917
|
+
<span class='kw'>end</span>
|
918
|
+
|
919
|
+
<span class='comment'># :nodoc:
|
920
|
+
</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>
|
921
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:result</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
922
|
+
<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>
|
923
|
+
<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>
|
924
|
+
<span class='kw'>end</span>
|
925
|
+
|
926
|
+
<span class='kw'>nil</span>
|
927
|
+
<span class='rbrace'>}</span>
|
928
|
+
<span class='kw'>end</span>
|
929
|
+
<span class='kw'>end</span></pre>
|
930
|
+
</td>
|
931
|
+
</tr>
|
932
|
+
</table>
|
933
|
+
</div>
|
934
|
+
|
935
|
+
</div>
|
936
|
+
|
937
|
+
|
938
|
+
<div id="instance_method_details" class="method_details_list">
|
939
|
+
<h2>Instance Method Details</h2>
|
940
|
+
|
941
|
+
|
942
|
+
<div class="method_details first">
|
943
|
+
<h3 class="signature first" id="match-instance_method">
|
944
|
+
|
945
|
+
- (<tt>Array|NilClass</tt>) <strong>match</strong>(header)
|
946
|
+
|
947
|
+
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
</h3><div class="docstring">
|
952
|
+
<div class="discussion">
|
953
|
+
<p>Matches against an header.</p>
|
954
|
+
|
955
|
+
|
956
|
+
</div>
|
957
|
+
</div>
|
958
|
+
<div class="tags">
|
959
|
+
<p class="tag_title">Parameters:</p>
|
960
|
+
<ul class="param">
|
961
|
+
|
962
|
+
<li>
|
963
|
+
|
964
|
+
<span class='name'>header</span>
|
965
|
+
|
966
|
+
|
967
|
+
<span class='type'>(<tt>String</tt>)</span>
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
—
|
972
|
+
<div class='inline'><p>The header to match</p>
|
973
|
+
</div>
|
974
|
+
|
975
|
+
</li>
|
976
|
+
|
977
|
+
</ul>
|
978
|
+
|
979
|
+
<p class="tag_title">Returns:</p>
|
980
|
+
<ul class="return">
|
981
|
+
|
982
|
+
<li>
|
983
|
+
|
984
|
+
|
985
|
+
<span class='type'>(<tt>Array|NilClass</tt>)</span>
|
986
|
+
|
987
|
+
|
988
|
+
|
989
|
+
—
|
990
|
+
<div class='inline'><p>An array with the engine and the version if match succeeded, <code>false</code> or <code>nil</code> otherwise.</p>
|
991
|
+
</div>
|
992
|
+
|
993
|
+
</li>
|
994
|
+
|
995
|
+
</ul>
|
996
|
+
|
997
|
+
</div><table class="source_code">
|
998
|
+
<tr>
|
999
|
+
<td>
|
1000
|
+
<pre class="lines">
|
1001
|
+
|
1002
|
+
|
1003
|
+
36
|
1004
|
+
37
|
1005
|
+
38
|
1006
|
+
39
|
1007
|
+
40
|
1008
|
+
41
|
1009
|
+
42
|
1010
|
+
43
|
1011
|
+
44
|
1012
|
+
45
|
1013
|
+
46
|
1014
|
+
47</pre>
|
1015
|
+
</td>
|
1016
|
+
<td>
|
1017
|
+
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 36</span>
|
1018
|
+
|
1019
|
+
<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>
|
1020
|
+
<span class='comment'># First of all, match the engine
|
1021
|
+
</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>
|
1022
|
+
|
1023
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_engine'>engine</span>
|
1024
|
+
<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>
|
1025
|
+
<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>
|
1026
|
+
<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>
|
1027
|
+
<span class='kw'>else</span>
|
1028
|
+
<span class='kw'>nil</span>
|
1029
|
+
<span class='kw'>end</span>
|
1030
|
+
<span class='kw'>end</span></pre>
|
1031
|
+
</td>
|
1032
|
+
</tr>
|
1033
|
+
</table>
|
1034
|
+
</div>
|
1035
|
+
|
1036
|
+
</div>
|
1037
|
+
|
1038
|
+
</div>
|
1039
|
+
|
1040
|
+
<div id="footer">
|
1041
|
+
Generated on Mon Sep 29 16:43:32 2014 by
|
1042
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1043
|
+
0.8.7.4 (ruby-2.1.3).
|
1044
|
+
</div>
|
1045
|
+
|
1046
|
+
</body>
|
1047
|
+
</html>
|