brauser 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Class: Brauser::Value
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -285,9 +285,10 @@
285
285
  <td>
286
286
  <pre class="code"><span class="info file"># File 'lib/brauser/value.rb', line 18</span>
287
287
 
288
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
289
- <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
290
- <span class='kw'>end</span></pre>
288
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_value identifier id'>value</span><span class='rparen token'>)</span>
289
+ <span class='rubyid_@value ivar id'>@value</span> <span class='assign token'>=</span> <span class='rubyid_value identifier id'>value</span>
290
+ <span class='rubyid_end end kw'>end</span>
291
+ </pre>
291
292
  </td>
292
293
  </tr>
293
294
  </table>
@@ -382,9 +383,10 @@
382
383
  <td>
383
384
  <pre class="code"><span class="info file"># File 'lib/brauser/value.rb', line 35</span>
384
385
 
385
- <span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
386
- <span class='ivar'>@value</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='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
387
- <span class='kw'>end</span></pre>
386
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
387
+ <span class='rubyid_@value ivar id'>@value</span><span class='dot token'>.</span><span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
388
+ <span class='rubyid_end end kw'>end</span>
389
+ </pre>
388
390
  </td>
389
391
  </tr>
390
392
  </table>
@@ -471,34 +473,35 @@
471
473
  <td>
472
474
  <pre class="code"><span class="info file"># File 'lib/brauser/value.rb', line 11</span>
473
475
 
474
- <span class='kw'>class</span> <span class='const'>Value</span>
475
- <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:value</span>
476
- <span class='id identifier rubyid_delegate'>delegate</span> <span class='symbol'>:to_s</span><span class='comma'>,</span> <span class='symbol'>:inspect</span><span class='comma'>,</span> <span class='label'>to:</span> <span class='symbol'>:value</span>
477
-
478
- <span class='comment'># Creates a new value
479
- </span> <span class='comment'>#
480
- </span> <span class='comment'># @param value [Object] The wrapped value.
481
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
482
- <span class='ivar'>@value</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
483
- <span class='kw'>end</span>
484
-
485
- <span class='comment'># Check if an object is equal to another object or if it is contained in a list of objects.
486
- </span> <span class='comment'>#
487
- </span> <span class='comment'># @param other [Array|Object] The other object to match.
488
- </span> <span class='comment'># @return [Boolean] `true` if the current object is either equal or contained in the other object, `false` otherwise.
489
- </span> <span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
490
- <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='ivar'>@value</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='ivar'>@value</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
491
- <span class='kw'>end</span>
492
-
493
- <span class='comment'># Delegates all the other values to the wrapped value.
494
- </span> <span class='comment'>#
495
- </span> <span class='comment'># @param method [Symbol] The method to call.
496
- </span> <span class='comment'># @param args [Array] The arguments to pass to the method.
497
- </span> <span class='comment'># @param block [Proc] The block to pass to the method.
498
- </span> <span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_method'>method</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
499
- <span class='ivar'>@value</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='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
500
- <span class='kw'>end</span>
501
- <span class='kw'>end</span></pre>
476
+ <span class='rubyid_class class kw'>class</span> <span class='rubyid_Value constant id'>Value</span>
477
+ <span class='rubyid_attr_reader identifier id'>attr_reader</span> <span class='symbol val'>:value</span>
478
+ <span class='rubyid_delegate identifier id'>delegate</span> <span class='symbol val'>:to_s</span><span class='comma token'>,</span> <span class='symbol val'>:inspect</span><span class='comma token'>,</span> <span class='label val'>to:</span> <span class='symbol val'>:value</span>
479
+
480
+ <span class='comment val'># Creates a new value</span>
481
+ <span class='comment val'>#</span>
482
+ <span class='comment val'># @param value [Object] The wrapped value.</span>
483
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_value identifier id'>value</span><span class='rparen token'>)</span>
484
+ <span class='rubyid_@value ivar id'>@value</span> <span class='assign token'>=</span> <span class='rubyid_value identifier id'>value</span>
485
+ <span class='rubyid_end end kw'>end</span>
486
+
487
+ <span class='comment val'># Check if an object is equal to another object or if it is contained in a list of objects.</span>
488
+ <span class='comment val'>#</span>
489
+ <span class='comment val'># @param other [Array|Object] The other object to match.</span>
490
+ <span class='comment val'># @return [Boolean] `true` if the current object is either equal or contained in the other object, `false` otherwise.</span>
491
+ <span class='rubyid_def def kw'>def</span> <span class='eq op'>==</span><span class='lparen token'>(</span><span class='rubyid_other identifier id'>other</span><span class='rparen token'>)</span>
492
+ <span class='rubyid_other identifier id'>other</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Array constant id'>Array</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_other identifier id'>other</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_@value ivar id'>@value</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='lparen token'>(</span><span class='rubyid_@value ivar id'>@value</span> <span class='eq op'>==</span> <span class='rubyid_other identifier id'>other</span><span class='rparen token'>)</span>
493
+ <span class='rubyid_end end kw'>end</span>
494
+
495
+ <span class='comment val'># Delegates all the other values to the wrapped value.</span>
496
+ <span class='comment val'>#</span>
497
+ <span class='comment val'># @param method [Symbol] The method to call.</span>
498
+ <span class='comment val'># @param args [Array] The arguments to pass to the method.</span>
499
+ <span class='comment val'># @param block [Proc] The block to pass to the method.</span>
500
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
501
+ <span class='rubyid_@value ivar id'>@value</span><span class='dot token'>.</span><span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='rubyid_method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='rubyid_args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='rubyid_block identifier id'>block</span><span class='rparen token'>)</span>
502
+ <span class='rubyid_end end kw'>end</span>
503
+ <span class='rubyid_end end kw'>end</span>
504
+ </pre>
502
505
  </td>
503
506
  </tr>
504
507
  </table>
@@ -579,9 +582,10 @@
579
582
  <td>
580
583
  <pre class="code"><span class="info file"># File 'lib/brauser/value.rb', line 26</span>
581
584
 
582
- <span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
583
- <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='ivar'>@value</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='lparen'>(</span><span class='ivar'>@value</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
584
- <span class='kw'>end</span></pre>
585
+ <span class='rubyid_def def kw'>def</span> <span class='eq op'>==</span><span class='lparen token'>(</span><span class='rubyid_other identifier id'>other</span><span class='rparen token'>)</span>
586
+ <span class='rubyid_other identifier id'>other</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='rubyid_Array constant id'>Array</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='rubyid_other identifier id'>other</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_@value ivar id'>@value</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='lparen token'>(</span><span class='rubyid_@value ivar id'>@value</span> <span class='eq op'>==</span> <span class='rubyid_other identifier id'>other</span><span class='rparen token'>)</span>
587
+ <span class='rubyid_end end kw'>end</span>
588
+ </pre>
585
589
  </td>
586
590
  </tr>
587
591
  </table>
@@ -592,9 +596,9 @@
592
596
  </div>
593
597
 
594
598
  <div id="footer">
595
- Generated on Mon Sep 29 16:43:31 2014 by
599
+ Generated on Mon Mar 2 13:10:31 2015 by
596
600
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
597
- 0.8.7.4 (ruby-2.1.3).
601
+ 0.8.7.6 (ruby-2.2.0).
598
602
  </div>
599
603
 
600
604
  </body>
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  Module: Brauser::Version
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -119,7 +119,8 @@
119
119
 
120
120
  </div>
121
121
  </dt>
122
- <dd><pre class="code"><span class='int'>4</span></pre></dd>
122
+ <dd><pre class="code"><span class='integer val'>4</span>
123
+ </pre></dd>
123
124
 
124
125
  <dt id="MINOR-constant" class="">MINOR =
125
126
  <div class="docstring">
@@ -134,7 +135,8 @@
134
135
 
135
136
  </div>
136
137
  </dt>
137
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
138
+ <dd><pre class="code"><span class='integer val'>1</span>
139
+ </pre></dd>
138
140
 
139
141
  <dt id="PATCH-constant" class="">PATCH =
140
142
  <div class="docstring">
@@ -149,7 +151,8 @@
149
151
 
150
152
  </div>
151
153
  </dt>
152
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
154
+ <dd><pre class="code"><span class='integer val'>0</span>
155
+ </pre></dd>
153
156
 
154
157
  <dt id="STRING-constant" class="">STRING =
155
158
  <div class="docstring">
@@ -164,7 +167,8 @@
164
167
 
165
168
  </div>
166
169
  </dt>
167
- <dd><pre class="code"><span class='lbracket'>[</span><span class='const'>MAJOR</span><span class='comma'>,</span> <span class='const'>MINOR</span><span class='comma'>,</span> <span class='const'>PATCH</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></pre></dd>
170
+ <dd><pre class="code"><span class='lbrack token'>[</span><span class='rubyid_MAJOR constant id'>MAJOR</span><span class='comma token'>,</span> <span class='rubyid_MINOR constant id'>MINOR</span><span class='comma token'>,</span> <span class='rubyid_PATCH constant id'>PATCH</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_compact identifier id'>compact</span><span class='dot token'>.</span><span class='rubyid_join identifier id'>join</span><span class='lparen token'>(</span><span class='string val'>&quot;.&quot;</span><span class='rparen token'>)</span>
171
+ </pre></dd>
168
172
 
169
173
  </dl>
170
174
 
@@ -180,9 +184,9 @@
180
184
  </div>
181
185
 
182
186
  <div id="footer">
183
- Generated on Mon Sep 29 16:43:31 2014 by
187
+ Generated on Mon Mar 2 13:10:31 2015 by
184
188
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
- 0.8.7.4 (ruby-2.1.3).
189
+ 0.8.7.6 (ruby-2.2.0).
186
190
  </div>
187
191
 
188
192
  </body>
data/doc/_index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
6
  <title>
7
- Documentation by YARD 0.8.7.4
7
+ Documentation by YARD 0.8.7.6
8
8
 
9
9
  </title>
10
10
 
@@ -56,7 +56,7 @@
56
56
 
57
57
  <iframe id="search_frame"></iframe>
58
58
 
59
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.7.4</h1>
59
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.7.6</h1>
60
60
  <div id="listing">
61
61
  <h1 class="alphaindex">Alphabetic Index</h1>
62
62
 
@@ -226,9 +226,9 @@
226
226
  </div>
227
227
 
228
228
  <div id="footer">
229
- Generated on Mon Sep 29 16:43:31 2014 by
229
+ Generated on Mon Mar 2 13:10:30 2015 by
230
230
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
231
- 0.8.7.4 (ruby-2.1.3).
231
+ 0.8.7.6 (ruby-2.2.0).
232
232
  </div>
233
233
 
234
234
  </body>
data/doc/class_list.html CHANGED
@@ -20,7 +20,11 @@
20
20
  </head>
21
21
  <body>
22
22
  <script type="text/javascript" charset="utf-8">
23
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
24
28
  document.getElementById('base_target').target = 'main';
25
29
  document.body.className = 'frames';
26
30
  }
data/doc/file.README.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -102,7 +102,7 @@ browser = Brauser::Browser.new(USER_AGENT_HEADER, ACCEPT_LANGUAGE_HEADER)
102
102
 
103
103
  <h3 id="getting-browser-information">Getting browser information</h3>
104
104
 
105
- <p>Once you instantiate the browser, you can query the browser about <code>name</code>, <code>version</code>, <code>platform</code>, <code>languages</code>. </p>
105
+ <p>Once you instantiate the browser, you can query the browser about <code>name</code>, <code>version</code>, <code>platform</code>, <code>languages</code>.</p>
106
106
 
107
107
  <p>You can also get readable name and platforms via <code>human_name</code>, <code>human_platform</code>, <code>human_languages</code>.</p>
108
108
 
@@ -116,99 +116,126 @@ browser = Brauser::Browser.new(USER_AGENT_HEADER, ACCEPT_LANGUAGE_HEADER)
116
116
 
117
117
  <p>For example, if you do this in a ERB view:</p>
118
118
 
119
- <p><code>html
120
- &lt;body class="&lt;%= browser.classes %&gt;"&gt;
119
+ <p>```html</p>
120
+ <body class="&lt;%= browser.classes %&gt;">
121
121
  ...
122
- </code></p>
122
+ ```
123
123
 
124
- <p>The view will get compiled to this:</p>
124
+ The view will get compiled to this:
125
125
 
126
- <p><code>html
127
- &lt;body class="chrome version-1 version-1_2 version-1_2_3 platform-osx"&gt;
126
+ ```html
127
+ <body class="chrome version-1 version-1_2 version-1_2_3 platform-osx">
128
128
  ...
129
- </code></p>
129
+ ```
130
130
 
131
- <p>And thus scoping your CSS will be trivial.</p>
131
+ And thus scoping your CSS will be trivial.
132
132
 
133
- <h3 id="querying-the-browser">Querying the browser</h3>
133
+ ### Querying the browser
134
134
 
135
- <p>Brauser supports querying about name, version, platform, language.</p>
135
+ Brauser supports querying about name, version, platform, language.
136
136
 
137
- <p>name and platform support querying via the <code>==</code> operator, which supports a single value or a list of values. </p>
137
+ Name and platform support querying via the `==` operator, which supports a single value or a list of values.
138
138
 
139
- <p><code>ruby
140
- # We talk about the ending ? later.
139
+ ```ruby
140
+ # We'll talk about the ending "?" later.
141
141
  browser.name == :chrome
142
142
  # =&gt; true
143
143
  browser.name == [:msie, :firefox]
144
144
  # =&gt; false
145
- </code></p>
145
+ ```
146
146
 
147
- <p>The version is delegated to the versionomy gem. You can use comparison operator. The right hand part must be either a <code>String</code> or a <code>Versionomy::Value</code>.</p>
147
+ The version is delegated to the versionomy gem. You can use comparison operator. The right hand part must be either a `String` or a `Versionomy::Value`.
148
148
 
149
- <p><code>ruby
149
+ ```ruby
150
150
  browser.version == "3"
151
151
  # =&gt; false
152
152
  browser.version &gt;= "2"
153
153
  # =&gt; true
154
- </code></p>
154
+ ```
155
155
 
156
- <p>The language support querying via the <code>accepts?</code> method, which supports a single value or a list of values.</p>
156
+ The language support querying via the `accepts?` method, which supports a single value or a list of values.
157
157
 
158
- <p><code>ruby
158
+ ```ruby
159
159
  browser.accepts?(:it)
160
160
  # =&gt; true
161
161
  browser.accepts?(:it, :en)
162
162
  # =&gt; true
163
- </code></p>
163
+ ```
164
164
 
165
- <p>All the querying can be combined in the single method <code>is?</code>:</p>
165
+ All the querying can be combined in the single method `is?`:
166
166
 
167
- <p><code>ruby
167
+ ```ruby
168
168
  browser.is?(name: :chrome, version: "&gt;= 4", platform: [:osx, :windows], languages: :it)
169
169
  # =&gt; false
170
- </code></p>
170
+ ```
171
+
172
+ Name, platform and languages can be either symbols or array of symbols. Version must be a query in the form is `OPERATOR VALUE &amp;&amp; ..`,
173
+ where `OPERATOR` is one of `["&lt;", "&lt;=", "=", "==", "&gt;=", "&gt;"]` and value specifies the version.
171
174
 
172
- <p>Name, platform and languages can be either symbols or array of symbols. Version must be a query in the form is <code>OPERATOR VALUE &amp;&amp; ..</code>,
173
- where <code>OPERATOR</code> is one of <code>["&lt;", "&lt;=", "=", "==", "&gt;=", "&gt;"]</code> and value specifies the version.</p>
175
+ ### Prevent old browsers to access the Rails application.
174
176
 
175
- <h3 id="adding-new-browsers-platform-and-languages">Adding new browsers, platform and languages.</h3>
177
+ If you want to easily prevent a legacy browser to open your application, create a file `supported-browsers.yml` in the `config` folder with a similar content:
176
178
 
177
- <p>To add new browsers, simply call <code>::Brauser::Definitions.register(:browser, :id, ...)</code>.</p>
179
+ ```yaml
180
+ ---
181
+ chrome: 29
182
+ firefox: 28
183
+ safari: 6.1
184
+ msie: 11
185
+ ```
178
186
 
179
- <p>The first argument can be <code>:browser</code>, <code>:platform</code> or <code>:language</code>.
187
+ then create a filter in the `ApplicationController`:
188
+
189
+ ```ruby
190
+ class ApplicationController &lt; ActionController::Base
191
+ # ...
192
+
193
+ before_filter do
194
+ redirect_to(URL) unless browser.supported?(Rails.root + "config/supported-browsers.yml")
195
+ end
196
+
197
+ # ...
198
+ end
199
+ ```
200
+
201
+ and you are set.
202
+
203
+ ### Adding new browsers, platform and languages.
204
+
205
+ To add new browsers, simply call `::Brauser::Definitions.register(:browser, :id, ...)`.
206
+
207
+ The first argument can be `:browser`, `:platform` or `:language`.
180
208
  The second argument is the id of the definition.
181
- The remaining argument will be passed to the definition constructor.</p>
209
+ The remaining argument will be passed to the definition constructor.
182
210
 
183
- <p>For example, for Google Chrome the call should be:</p>
211
+ For example, for Google Chrome the call should be:
184
212
 
185
- <p><code>ruby
213
+ ```ruby
186
214
  Brauser::Definitions.register(:browsers, :chrome, "Chrome", /((chrome)|(chromium))/i, /(.+Chrom[a-z]+\/)([a-z0-9.]+)/i)
187
- </code></p>
188
-
189
- <h2 id="contributing-to-brauser">Contributing to brauser</h2>
215
+ ```
190
216
 
191
- <ul>
192
- <li>Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.</li>
193
- <li>Check out the issue tracker to make sure someone already hasnt requested it and/or contributed it.</li>
194
- <li>Fork the project.</li>
195
- <li>Start a feature/bugfix branch.</li>
196
- <li>Commit and push until you are happy with your contribution.</li>
197
- <li>Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.</li>
198
- <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
199
- </ul>
217
+ ## Contributing to brauser
218
+
219
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
220
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
221
+ * Fork the project.
222
+ * Start a feature/bugfix branch.
223
+ * Commit and push until you are happy with your contribution.
224
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
225
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
200
226
 
201
- <h2 id="copyright">Copyright</h2>
227
+ ## Copyright
202
228
 
203
- <p>Copyright (C) 2013 and above Shogun (shogun@cowtech.it).</p>
229
+ Copyright (C) 2013 and above Shogun (shogun@cowtech.it).
204
230
 
205
- <p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
231
+ Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
232
+ </body></body>
206
233
  </div></div>
207
234
 
208
235
  <div id="footer">
209
- Generated on Mon Sep 29 16:43:31 2014 by
236
+ Generated on Mon Mar 2 13:10:30 2015 by
210
237
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
211
- 0.8.7.4 (ruby-2.1.3).
238
+ 0.8.7.6 (ruby-2.2.0).
212
239
  </div>
213
240
 
214
241
  </body>
data/doc/file_list.html CHANGED
@@ -20,7 +20,11 @@
20
20
  </head>
21
21
  <body>
22
22
  <script type="text/javascript" charset="utf-8">
23
- if (window.top.frames.main) {
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
24
28
  document.getElementById('base_target').target = 'main';
25
29
  document.body.className = 'frames';
26
30
  }
data/doc/frames.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.8.7.4</title>
7
+ <title>Documentation by YARD 0.8.7.6</title>
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
data/doc/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>
7
7
  File: README
8
8
 
9
- &mdash; Documentation by YARD 0.8.7.4
9
+ &mdash; Documentation by YARD 0.8.7.6
10
10
 
11
11
  </title>
12
12
 
@@ -102,7 +102,7 @@ browser = Brauser::Browser.new(USER_AGENT_HEADER, ACCEPT_LANGUAGE_HEADER)
102
102
 
103
103
  <h3 id="getting-browser-information">Getting browser information</h3>
104
104
 
105
- <p>Once you instantiate the browser, you can query the browser about <code>name</code>, <code>version</code>, <code>platform</code>, <code>languages</code>. </p>
105
+ <p>Once you instantiate the browser, you can query the browser about <code>name</code>, <code>version</code>, <code>platform</code>, <code>languages</code>.</p>
106
106
 
107
107
  <p>You can also get readable name and platforms via <code>human_name</code>, <code>human_platform</code>, <code>human_languages</code>.</p>
108
108
 
@@ -116,99 +116,126 @@ browser = Brauser::Browser.new(USER_AGENT_HEADER, ACCEPT_LANGUAGE_HEADER)
116
116
 
117
117
  <p>For example, if you do this in a ERB view:</p>
118
118
 
119
- <p><code>html
120
- &lt;body class="&lt;%= browser.classes %&gt;"&gt;
119
+ <p>```html</p>
120
+ <body class="&lt;%= browser.classes %&gt;">
121
121
  ...
122
- </code></p>
122
+ ```
123
123
 
124
- <p>The view will get compiled to this:</p>
124
+ The view will get compiled to this:
125
125
 
126
- <p><code>html
127
- &lt;body class="chrome version-1 version-1_2 version-1_2_3 platform-osx"&gt;
126
+ ```html
127
+ <body class="chrome version-1 version-1_2 version-1_2_3 platform-osx">
128
128
  ...
129
- </code></p>
129
+ ```
130
130
 
131
- <p>And thus scoping your CSS will be trivial.</p>
131
+ And thus scoping your CSS will be trivial.
132
132
 
133
- <h3 id="querying-the-browser">Querying the browser</h3>
133
+ ### Querying the browser
134
134
 
135
- <p>Brauser supports querying about name, version, platform, language.</p>
135
+ Brauser supports querying about name, version, platform, language.
136
136
 
137
- <p>name and platform support querying via the <code>==</code> operator, which supports a single value or a list of values. </p>
137
+ Name and platform support querying via the `==` operator, which supports a single value or a list of values.
138
138
 
139
- <p><code>ruby
140
- # We talk about the ending ? later.
139
+ ```ruby
140
+ # We'll talk about the ending "?" later.
141
141
  browser.name == :chrome
142
142
  # =&gt; true
143
143
  browser.name == [:msie, :firefox]
144
144
  # =&gt; false
145
- </code></p>
145
+ ```
146
146
 
147
- <p>The version is delegated to the versionomy gem. You can use comparison operator. The right hand part must be either a <code>String</code> or a <code>Versionomy::Value</code>.</p>
147
+ The version is delegated to the versionomy gem. You can use comparison operator. The right hand part must be either a `String` or a `Versionomy::Value`.
148
148
 
149
- <p><code>ruby
149
+ ```ruby
150
150
  browser.version == "3"
151
151
  # =&gt; false
152
152
  browser.version &gt;= "2"
153
153
  # =&gt; true
154
- </code></p>
154
+ ```
155
155
 
156
- <p>The language support querying via the <code>accepts?</code> method, which supports a single value or a list of values.</p>
156
+ The language support querying via the `accepts?` method, which supports a single value or a list of values.
157
157
 
158
- <p><code>ruby
158
+ ```ruby
159
159
  browser.accepts?(:it)
160
160
  # =&gt; true
161
161
  browser.accepts?(:it, :en)
162
162
  # =&gt; true
163
- </code></p>
163
+ ```
164
164
 
165
- <p>All the querying can be combined in the single method <code>is?</code>:</p>
165
+ All the querying can be combined in the single method `is?`:
166
166
 
167
- <p><code>ruby
167
+ ```ruby
168
168
  browser.is?(name: :chrome, version: "&gt;= 4", platform: [:osx, :windows], languages: :it)
169
169
  # =&gt; false
170
- </code></p>
170
+ ```
171
+
172
+ Name, platform and languages can be either symbols or array of symbols. Version must be a query in the form is `OPERATOR VALUE &amp;&amp; ..`,
173
+ where `OPERATOR` is one of `["&lt;", "&lt;=", "=", "==", "&gt;=", "&gt;"]` and value specifies the version.
171
174
 
172
- <p>Name, platform and languages can be either symbols or array of symbols. Version must be a query in the form is <code>OPERATOR VALUE &amp;&amp; ..</code>,
173
- where <code>OPERATOR</code> is one of <code>["&lt;", "&lt;=", "=", "==", "&gt;=", "&gt;"]</code> and value specifies the version.</p>
175
+ ### Prevent old browsers to access the Rails application.
174
176
 
175
- <h3 id="adding-new-browsers-platform-and-languages">Adding new browsers, platform and languages.</h3>
177
+ If you want to easily prevent a legacy browser to open your application, create a file `supported-browsers.yml` in the `config` folder with a similar content:
176
178
 
177
- <p>To add new browsers, simply call <code>::Brauser::Definitions.register(:browser, :id, ...)</code>.</p>
179
+ ```yaml
180
+ ---
181
+ chrome: 29
182
+ firefox: 28
183
+ safari: 6.1
184
+ msie: 11
185
+ ```
178
186
 
179
- <p>The first argument can be <code>:browser</code>, <code>:platform</code> or <code>:language</code>.
187
+ then create a filter in the `ApplicationController`:
188
+
189
+ ```ruby
190
+ class ApplicationController &lt; ActionController::Base
191
+ # ...
192
+
193
+ before_filter do
194
+ redirect_to(URL) unless browser.supported?(Rails.root + "config/supported-browsers.yml")
195
+ end
196
+
197
+ # ...
198
+ end
199
+ ```
200
+
201
+ and you are set.
202
+
203
+ ### Adding new browsers, platform and languages.
204
+
205
+ To add new browsers, simply call `::Brauser::Definitions.register(:browser, :id, ...)`.
206
+
207
+ The first argument can be `:browser`, `:platform` or `:language`.
180
208
  The second argument is the id of the definition.
181
- The remaining argument will be passed to the definition constructor.</p>
209
+ The remaining argument will be passed to the definition constructor.
182
210
 
183
- <p>For example, for Google Chrome the call should be:</p>
211
+ For example, for Google Chrome the call should be:
184
212
 
185
- <p><code>ruby
213
+ ```ruby
186
214
  Brauser::Definitions.register(:browsers, :chrome, "Chrome", /((chrome)|(chromium))/i, /(.+Chrom[a-z]+\/)([a-z0-9.]+)/i)
187
- </code></p>
188
-
189
- <h2 id="contributing-to-brauser">Contributing to brauser</h2>
215
+ ```
190
216
 
191
- <ul>
192
- <li>Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.</li>
193
- <li>Check out the issue tracker to make sure someone already hasnt requested it and/or contributed it.</li>
194
- <li>Fork the project.</li>
195
- <li>Start a feature/bugfix branch.</li>
196
- <li>Commit and push until you are happy with your contribution.</li>
197
- <li>Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.</li>
198
- <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
199
- </ul>
217
+ ## Contributing to brauser
218
+
219
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
220
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
221
+ * Fork the project.
222
+ * Start a feature/bugfix branch.
223
+ * Commit and push until you are happy with your contribution.
224
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
225
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
200
226
 
201
- <h2 id="copyright">Copyright</h2>
227
+ ## Copyright
202
228
 
203
- <p>Copyright (C) 2013 and above Shogun (shogun@cowtech.it).</p>
229
+ Copyright (C) 2013 and above Shogun (shogun@cowtech.it).
204
230
 
205
- <p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
231
+ Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
232
+ </body></body>
206
233
  </div></div>
207
234
 
208
235
  <div id="footer">
209
- Generated on Mon Sep 29 16:43:31 2014 by
236
+ Generated on Mon Mar 2 13:10:30 2015 by
210
237
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
211
- 0.8.7.4 (ruby-2.1.3).
238
+ 0.8.7.6 (ruby-2.2.0).
212
239
  </div>
213
240
 
214
241
  </body>