brauser 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -3
- data/.rubocop.yml +47 -5
- data/.travis.yml +6 -3
- data/CHANGELOG.md +5 -1
- data/Gemfile +1 -0
- data/README.md +0 -1
- data/Rakefile +15 -14
- data/brauser.gemspec +1 -1
- data/doc/Brauser.html +1 -1
- data/doc/Brauser/Browser.html +145 -181
- data/doc/Brauser/Definitions.html +1 -1
- data/doc/Brauser/Definitions/Base.html +1 -1
- data/doc/Brauser/Definitions/Browser.html +11 -27
- data/doc/Brauser/Definitions/Language.html +1 -1
- data/doc/Brauser/Definitions/Platform.html +1 -1
- data/doc/Brauser/Hooks.html +1 -1
- data/doc/Brauser/Hooks/RubyOnRails.html +1 -1
- data/doc/Brauser/Parser.html +5 -5
- data/doc/Brauser/Value.html +1 -1
- data/doc/Brauser/Version.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +2 -3
- data/doc/index.html +2 -3
- data/doc/top-level-namespace.html +1 -1
- data/lib/brauser/browser.rb +15 -17
- data/lib/brauser/definitions/browser.rb +2 -4
- data/lib/brauser/parser.rb +4 -4
- data/lib/brauser/version.rb +2 -2
- data/spec/spec_helper.rb +17 -0
- metadata +3 -3
@@ -532,7 +532,7 @@
|
|
532
532
|
</div>
|
533
533
|
|
534
534
|
<div id="footer">
|
535
|
-
Generated on
|
535
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
536
536
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
537
537
|
0.8.7.6 (ruby-2.3.0).
|
538
538
|
</div>
|
@@ -335,7 +335,7 @@
|
|
335
335
|
</div>
|
336
336
|
|
337
337
|
<div id="footer">
|
338
|
-
Generated on
|
338
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
339
339
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
340
340
|
0.8.7.6 (ruby-2.3.0).
|
341
341
|
</div>
|
@@ -500,9 +500,7 @@
|
|
500
500
|
73
|
501
501
|
74
|
502
502
|
75
|
503
|
-
76
|
504
|
-
77
|
505
|
-
78</pre>
|
503
|
+
76</pre>
|
506
504
|
</td>
|
507
505
|
<td>
|
508
506
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
@@ -535,8 +533,6 @@
|
|
535
533
|
<span class='rubyid_version identifier id'>version</span> <span class='assign token'>=</span> <span class='rubyid_extract_version identifier id'>extract_version</span><span class='lparen token'>(</span><span class='rubyid_perform_match identifier id'>perform_match</span><span class='lparen token'>(</span><span class='rubyid_@version_matcher ivar id'>@version_matcher</span><span class='comma token'>,</span> <span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
536
534
|
<span class='rubyid_platform identifier id'>platform</span> <span class='assign token'>=</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
537
535
|
<span class='lbrack token'>[</span><span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_version identifier id'>version</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span><span class='rbrack token'>]</span>
|
538
|
-
<span class='rubyid_else else kw'>else</span>
|
539
|
-
<span class='rubyid_nil nil kw'>nil</span>
|
540
536
|
<span class='rubyid_end end kw'>end</span>
|
541
537
|
<span class='rubyid_end end kw'>end</span>
|
542
538
|
|
@@ -561,13 +557,13 @@
|
|
561
557
|
|
562
558
|
<span class='comment val'># :nodoc:</span>
|
563
559
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
564
|
-
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='
|
560
|
+
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
565
561
|
<span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Definitions constant id'>Definitions</span><span class='dot token'>.</span><span class='rubyid_platforms identifier id'>platforms</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_platform identifier id'>platform</span><span class='comma token'>,</span> <span class='rubyid_definition identifier id'>definition</span><span class='bitor op'>|</span>
|
566
562
|
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='comma token'>,</span> <span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_definition identifier id'>definition</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
567
563
|
<span class='rubyid_end end kw'>end</span>
|
568
564
|
|
569
565
|
<span class='rubyid_nil nil kw'>nil</span>
|
570
|
-
<span class='
|
566
|
+
<span class='rubyid_end end kw'>end</span>
|
571
567
|
<span class='rubyid_end end kw'>end</span>
|
572
568
|
<span class='rubyid_end end kw'>end</span>
|
573
569
|
</pre>
|
@@ -680,9 +676,7 @@
|
|
680
676
|
73
|
681
677
|
74
|
682
678
|
75
|
683
|
-
76
|
684
|
-
77
|
685
|
-
78</pre>
|
679
|
+
76</pre>
|
686
680
|
</td>
|
687
681
|
<td>
|
688
682
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
@@ -715,8 +709,6 @@
|
|
715
709
|
<span class='rubyid_version identifier id'>version</span> <span class='assign token'>=</span> <span class='rubyid_extract_version identifier id'>extract_version</span><span class='lparen token'>(</span><span class='rubyid_perform_match identifier id'>perform_match</span><span class='lparen token'>(</span><span class='rubyid_@version_matcher ivar id'>@version_matcher</span><span class='comma token'>,</span> <span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
716
710
|
<span class='rubyid_platform identifier id'>platform</span> <span class='assign token'>=</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
717
711
|
<span class='lbrack token'>[</span><span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_version identifier id'>version</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span><span class='rbrack token'>]</span>
|
718
|
-
<span class='rubyid_else else kw'>else</span>
|
719
|
-
<span class='rubyid_nil nil kw'>nil</span>
|
720
712
|
<span class='rubyid_end end kw'>end</span>
|
721
713
|
<span class='rubyid_end end kw'>end</span>
|
722
714
|
|
@@ -741,13 +733,13 @@
|
|
741
733
|
|
742
734
|
<span class='comment val'># :nodoc:</span>
|
743
735
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
744
|
-
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='
|
736
|
+
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
745
737
|
<span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Definitions constant id'>Definitions</span><span class='dot token'>.</span><span class='rubyid_platforms identifier id'>platforms</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_platform identifier id'>platform</span><span class='comma token'>,</span> <span class='rubyid_definition identifier id'>definition</span><span class='bitor op'>|</span>
|
746
738
|
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='comma token'>,</span> <span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_definition identifier id'>definition</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
747
739
|
<span class='rubyid_end end kw'>end</span>
|
748
740
|
|
749
741
|
<span class='rubyid_nil nil kw'>nil</span>
|
750
|
-
<span class='
|
742
|
+
<span class='rubyid_end end kw'>end</span>
|
751
743
|
<span class='rubyid_end end kw'>end</span>
|
752
744
|
<span class='rubyid_end end kw'>end</span>
|
753
745
|
</pre>
|
@@ -860,9 +852,7 @@
|
|
860
852
|
73
|
861
853
|
74
|
862
854
|
75
|
863
|
-
76
|
864
|
-
77
|
865
|
-
78</pre>
|
855
|
+
76</pre>
|
866
856
|
</td>
|
867
857
|
<td>
|
868
858
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 16</span>
|
@@ -895,8 +885,6 @@
|
|
895
885
|
<span class='rubyid_version identifier id'>version</span> <span class='assign token'>=</span> <span class='rubyid_extract_version identifier id'>extract_version</span><span class='lparen token'>(</span><span class='rubyid_perform_match identifier id'>perform_match</span><span class='lparen token'>(</span><span class='rubyid_@version_matcher ivar id'>@version_matcher</span><span class='comma token'>,</span> <span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
896
886
|
<span class='rubyid_platform identifier id'>platform</span> <span class='assign token'>=</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
897
887
|
<span class='lbrack token'>[</span><span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_version identifier id'>version</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span><span class='rbrack token'>]</span>
|
898
|
-
<span class='rubyid_else else kw'>else</span>
|
899
|
-
<span class='rubyid_nil nil kw'>nil</span>
|
900
888
|
<span class='rubyid_end end kw'>end</span>
|
901
889
|
<span class='rubyid_end end kw'>end</span>
|
902
890
|
|
@@ -921,13 +909,13 @@
|
|
921
909
|
|
922
910
|
<span class='comment val'># :nodoc:</span>
|
923
911
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
924
|
-
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='
|
912
|
+
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
925
913
|
<span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Definitions constant id'>Definitions</span><span class='dot token'>.</span><span class='rubyid_platforms identifier id'>platforms</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_platform identifier id'>platform</span><span class='comma token'>,</span> <span class='rubyid_definition identifier id'>definition</span><span class='bitor op'>|</span>
|
926
914
|
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='comma token'>,</span> <span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_definition identifier id'>definition</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
927
915
|
<span class='rubyid_end end kw'>end</span>
|
928
916
|
|
929
917
|
<span class='rubyid_nil nil kw'>nil</span>
|
930
|
-
<span class='
|
918
|
+
<span class='rubyid_end end kw'>end</span>
|
931
919
|
<span class='rubyid_end end kw'>end</span>
|
932
920
|
<span class='rubyid_end end kw'>end</span>
|
933
921
|
</pre>
|
@@ -1013,9 +1001,7 @@
|
|
1013
1001
|
42
|
1014
1002
|
43
|
1015
1003
|
44
|
1016
|
-
45
|
1017
|
-
46
|
1018
|
-
47</pre>
|
1004
|
+
45</pre>
|
1019
1005
|
</td>
|
1020
1006
|
<td>
|
1021
1007
|
<pre class="code"><span class="info file"># File 'lib/brauser/definitions/browser.rb', line 36</span>
|
@@ -1028,8 +1014,6 @@
|
|
1028
1014
|
<span class='rubyid_version identifier id'>version</span> <span class='assign token'>=</span> <span class='rubyid_extract_version identifier id'>extract_version</span><span class='lparen token'>(</span><span class='rubyid_perform_match identifier id'>perform_match</span><span class='lparen token'>(</span><span class='rubyid_@version_matcher ivar id'>@version_matcher</span><span class='comma token'>,</span> <span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
1029
1015
|
<span class='rubyid_platform identifier id'>platform</span> <span class='assign token'>=</span> <span class='rubyid_extract_platform identifier id'>extract_platform</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='comma token'>,</span> <span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span>
|
1030
1016
|
<span class='lbrack token'>[</span><span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_engine identifier id'>engine</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_version identifier id'>version</span><span class='rparen token'>)</span><span class='comma token'>,</span> <span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Value constant id'>Value</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_platform identifier id'>platform</span><span class='rparen token'>)</span><span class='rbrack token'>]</span>
|
1031
|
-
<span class='rubyid_else else kw'>else</span>
|
1032
|
-
<span class='rubyid_nil nil kw'>nil</span>
|
1033
1017
|
<span class='rubyid_end end kw'>end</span>
|
1034
1018
|
<span class='rubyid_end end kw'>end</span>
|
1035
1019
|
</pre>
|
@@ -1043,7 +1027,7 @@
|
|
1043
1027
|
</div>
|
1044
1028
|
|
1045
1029
|
<div id="footer">
|
1046
|
-
Generated on
|
1030
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
1047
1031
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1048
1032
|
0.8.7.6 (ruby-2.3.0).
|
1049
1033
|
</div>
|
@@ -490,7 +490,7 @@
|
|
490
490
|
</div>
|
491
491
|
|
492
492
|
<div id="footer">
|
493
|
-
Generated on
|
493
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
494
494
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
495
495
|
0.8.7.6 (ruby-2.3.0).
|
496
496
|
</div>
|
@@ -681,7 +681,7 @@
|
|
681
681
|
</div>
|
682
682
|
|
683
683
|
<div id="footer">
|
684
|
-
Generated on
|
684
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
685
685
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
686
686
|
0.8.7.6 (ruby-2.3.0).
|
687
687
|
</div>
|
data/doc/Brauser/Hooks.html
CHANGED
@@ -116,7 +116,7 @@
|
|
116
116
|
</div>
|
117
117
|
|
118
118
|
<div id="footer">
|
119
|
-
Generated on
|
119
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
121
121
|
0.8.7.6 (ruby-2.3.0).
|
122
122
|
</div>
|
@@ -325,7 +325,7 @@
|
|
325
325
|
</div>
|
326
326
|
|
327
327
|
<div id="footer">
|
328
|
-
Generated on
|
328
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
329
329
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
330
330
|
0.8.7.6 (ruby-2.3.0).
|
331
331
|
</div>
|
data/doc/Brauser/Parser.html
CHANGED
@@ -397,11 +397,11 @@
|
|
397
397
|
<pre class="code"><span class="info file"># File 'lib/brauser/parser.rb', line 39</span>
|
398
398
|
|
399
399
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_parse_accept_language identifier id'>parse_accept_language</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span>
|
400
|
-
<span class='rubyid_header identifier id'>header</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_tokenize identifier id'>tokenize</span><span class='dot token'>.</span><span class='rubyid_reduce identifier id'>reduce</span><span class='lparen token'>(</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='
|
400
|
+
<span class='rubyid_header identifier id'>header</span><span class='dot token'>.</span><span class='rubyid_ensure_string identifier id'>ensure_string</span><span class='dot token'>.</span><span class='rubyid_tokenize identifier id'>tokenize</span><span class='dot token'>.</span><span class='rubyid_reduce identifier id'>reduce</span><span class='lparen token'>(</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_rv identifier id'>rv</span><span class='comma token'>,</span> <span class='rubyid_token identifier id'>token</span><span class='bitor op'>|</span>
|
401
401
|
<span class='rubyid_code identifier id'>code</span><span class='comma token'>,</span> <span class='rubyid_priority identifier id'>priority</span> <span class='assign token'>=</span> <span class='rubyid_token identifier id'>token</span><span class='dot token'>.</span><span class='rubyid_split identifier id'>split</span><span class='lparen token'>(</span><span class='string val'>";q="</span><span class='rparen token'>)</span>
|
402
402
|
<span class='rubyid_rv identifier id'>rv</span><span class='lbrack token'>[</span><span class='rubyid_code identifier id'>code</span><span class='dot token'>.</span><span class='rubyid_downcase identifier id'>downcase</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='string val'>"_"</span><span class='comma token'>,</span> <span class='string val'>"-"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_priority identifier id'>priority</span><span class='dot token'>.</span><span class='rubyid_to_float identifier id'>to_float</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_code identifier id'>code</span> <span class='andop op'>&&</span> <span class='rubyid_priority identifier id'>priority</span>
|
403
403
|
<span class='rubyid_rv identifier id'>rv</span>
|
404
|
-
<span class='
|
404
|
+
<span class='rubyid_end end kw'>end</span>
|
405
405
|
<span class='rubyid_end end kw'>end</span>
|
406
406
|
</pre>
|
407
407
|
</td>
|
@@ -487,14 +487,14 @@
|
|
487
487
|
|
488
488
|
<span class='rubyid_def def kw'>def</span> <span class='rubyid_parse_agent identifier id'>parse_agent</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span>
|
489
489
|
<span class='comment val'># First of all match the agent and the version</span>
|
490
|
-
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='
|
490
|
+
<span class='rubyid_catch identifier id'>catch</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
|
491
491
|
<span class='rubyid_Brauser constant id'>Brauser</span><span class='colon2 op'>::</span><span class='rubyid_Definitions constant id'>Definitions</span><span class='dot token'>.</span><span class='rubyid_browsers identifier id'>browsers</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid__ identifier id'>_</span><span class='comma token'>,</span> <span class='rubyid_definition identifier id'>definition</span><span class='bitor op'>|</span>
|
492
492
|
<span class='rubyid_result identifier id'>result</span> <span class='assign token'>=</span> <span class='rubyid_definition identifier id'>definition</span><span class='dot token'>.</span><span class='rubyid_match identifier id'>match</span><span class='lparen token'>(</span><span class='rubyid_header identifier id'>header</span><span class='rparen token'>)</span>
|
493
493
|
<span class='rubyid_throw identifier id'>throw</span><span class='lparen token'>(</span><span class='symbol val'>:result</span><span class='comma token'>,</span> <span class='rubyid_result identifier id'>result</span><span class='rparen token'>)</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_result identifier id'>result</span>
|
494
494
|
<span class='rubyid_end end kw'>end</span>
|
495
495
|
|
496
496
|
<span class='rubyid_nil nil kw'>nil</span>
|
497
|
-
<span class='
|
497
|
+
<span class='rubyid_end end kw'>end</span>
|
498
498
|
<span class='rubyid_end end kw'>end</span>
|
499
499
|
</pre>
|
500
500
|
</td>
|
@@ -507,7 +507,7 @@
|
|
507
507
|
</div>
|
508
508
|
|
509
509
|
<div id="footer">
|
510
|
-
Generated on
|
510
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
511
511
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
512
512
|
0.8.7.6 (ruby-2.3.0).
|
513
513
|
</div>
|
data/doc/Brauser/Value.html
CHANGED
@@ -596,7 +596,7 @@
|
|
596
596
|
</div>
|
597
597
|
|
598
598
|
<div id="footer">
|
599
|
-
Generated on
|
599
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
600
600
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
601
601
|
0.8.7.6 (ruby-2.3.0).
|
602
602
|
</div>
|
data/doc/Brauser/Version.html
CHANGED
@@ -151,7 +151,7 @@
|
|
151
151
|
|
152
152
|
</div>
|
153
153
|
</dt>
|
154
|
-
<dd><pre class="code"><span class='integer val'>
|
154
|
+
<dd><pre class="code"><span class='integer val'>2</span>
|
155
155
|
</pre></dd>
|
156
156
|
|
157
157
|
<dt id="STRING-constant" class="">STRING =
|
@@ -184,7 +184,7 @@
|
|
184
184
|
</div>
|
185
185
|
|
186
186
|
<div id="footer">
|
187
|
-
Generated on
|
187
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
188
188
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
189
189
|
0.8.7.6 (ruby-2.3.0).
|
190
190
|
</div>
|
data/doc/_index.html
CHANGED
@@ -226,7 +226,7 @@
|
|
226
226
|
</div>
|
227
227
|
|
228
228
|
<div id="footer">
|
229
|
-
Generated on
|
229
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
230
230
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
231
231
|
0.8.7.6 (ruby-2.3.0).
|
232
232
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -67,8 +67,7 @@
|
|
67
67
|
<a href="https://gemnasium.com/ShogunPanda/brauser"><img src="https://gemnasium.com/ShogunPanda/brauser.png?travis" alt="Dependency Status" /></a>
|
68
68
|
<a href="http://travis-ci.org/ShogunPanda/brauser"><img src="https://secure.travis-ci.org/ShogunPanda/brauser.png?branch=master" alt="Build Status" /></a>
|
69
69
|
<a href="https://codeclimate.com/github/ShogunPanda/brauser"><img src="https://codeclimate.com/github/ShogunPanda/brauser.png" alt="Code Climate" /></a>
|
70
|
-
<a href="https://coveralls.io/r/ShogunPanda/brauser"><img src="https://coveralls.io/repos/ShogunPanda/brauser/badge.png" alt="Coverage Status" /></a>
|
71
|
-
<a href="https://bitdeli.com/free" title="Bitdeli Badge"><img src="https://d2weczhvl823v0.cloudfront.net/ShogunPanda/brauser/trend.png" alt="Bitdeli Trend" /></a></p>
|
70
|
+
<a href="https://coveralls.io/r/ShogunPanda/brauser"><img src="https://coveralls.io/repos/ShogunPanda/brauser/badge.png" alt="Coverage Status" /></a></p>
|
72
71
|
|
73
72
|
<p>A framework agnostic browser detection and querying helper.</p>
|
74
73
|
|
@@ -233,7 +232,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
233
232
|
</div></div>
|
234
233
|
|
235
234
|
<div id="footer">
|
236
|
-
Generated on
|
235
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
237
236
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
238
237
|
0.8.7.6 (ruby-2.3.0).
|
239
238
|
</div>
|
data/doc/index.html
CHANGED
@@ -67,8 +67,7 @@
|
|
67
67
|
<a href="https://gemnasium.com/ShogunPanda/brauser"><img src="https://gemnasium.com/ShogunPanda/brauser.png?travis" alt="Dependency Status" /></a>
|
68
68
|
<a href="http://travis-ci.org/ShogunPanda/brauser"><img src="https://secure.travis-ci.org/ShogunPanda/brauser.png?branch=master" alt="Build Status" /></a>
|
69
69
|
<a href="https://codeclimate.com/github/ShogunPanda/brauser"><img src="https://codeclimate.com/github/ShogunPanda/brauser.png" alt="Code Climate" /></a>
|
70
|
-
<a href="https://coveralls.io/r/ShogunPanda/brauser"><img src="https://coveralls.io/repos/ShogunPanda/brauser/badge.png" alt="Coverage Status" /></a>
|
71
|
-
<a href="https://bitdeli.com/free" title="Bitdeli Badge"><img src="https://d2weczhvl823v0.cloudfront.net/ShogunPanda/brauser/trend.png" alt="Bitdeli Trend" /></a></p>
|
70
|
+
<a href="https://coveralls.io/r/ShogunPanda/brauser"><img src="https://coveralls.io/repos/ShogunPanda/brauser/badge.png" alt="Coverage Status" /></a></p>
|
72
71
|
|
73
72
|
<p>A framework agnostic browser detection and querying helper.</p>
|
74
73
|
|
@@ -233,7 +232,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
|
|
233
232
|
</div></div>
|
234
233
|
|
235
234
|
<div id="footer">
|
236
|
-
Generated on
|
235
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
237
236
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
238
237
|
0.8.7.6 (ruby-2.3.0).
|
239
238
|
</div>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on
|
106
|
+
Generated on Tue Mar 29 11:20:20 2016 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.3.0).
|
109
109
|
</div>
|
data/lib/brauser/browser.rb
CHANGED
@@ -131,20 +131,25 @@ module Brauser
|
|
131
131
|
@human_name = Brauser::Definitions.browsers[@name].try(:name) || "Unknown Browser"
|
132
132
|
@human_platform = Brauser::Definitions.platforms[@platform].try(:name) || "Unknown Platform"
|
133
133
|
else
|
134
|
-
|
135
|
-
@human_name = @human_platform = Brauser::Value.new("Unknown")
|
136
|
-
@version = Brauser::Value.new(Versionomy.parse("0.0"))
|
134
|
+
sanitize_agent
|
137
135
|
end
|
138
136
|
end
|
139
137
|
|
138
|
+
# :nodoc:
|
139
|
+
def sanitize_agent
|
140
|
+
@name = @platform = Brauser::Value.new(:unknown)
|
141
|
+
@human_name = @human_platform = Brauser::Value.new("Unknown")
|
142
|
+
@version = Brauser::Value.new(Versionomy.parse("0.0"))
|
143
|
+
end
|
144
|
+
|
140
145
|
# :nodoc:
|
141
146
|
def parse_languages(parser)
|
142
147
|
languages = parser.parse_accept_language(@accept_language)
|
143
148
|
@languages = languages
|
144
|
-
@human_languages = languages.reduce({})
|
149
|
+
@human_languages = languages.reduce({}) do |rv, (code, priority)|
|
145
150
|
rv[Brauser::Definitions.languages[code].name] = priority
|
146
151
|
rv
|
147
|
-
|
152
|
+
end
|
148
153
|
end
|
149
154
|
|
150
155
|
# :nodoc:
|
@@ -154,8 +159,6 @@ module Brauser
|
|
154
159
|
rv = @name
|
155
160
|
rv = [:msie_compatibility, :msie] if rv == :msie_compatibility
|
156
161
|
rv.ensure_array(no_duplicates: true) { |n| "#{name}#{n}" }
|
157
|
-
else
|
158
|
-
nil
|
159
162
|
end
|
160
163
|
end
|
161
164
|
|
@@ -163,25 +166,20 @@ module Brauser
|
|
163
166
|
def version_to_str(version)
|
164
167
|
if version
|
165
168
|
version = "version-" if version.is_a?(TrueClass)
|
166
|
-
version_str = @version.values_array.reduce([])
|
169
|
+
version_str = @version.values_array.reduce([]) do |rv, current|
|
167
170
|
rv << [rv.last, current].compact.join("_")
|
168
171
|
rv
|
169
|
-
|
172
|
+
end
|
170
173
|
|
171
174
|
version_str.map { |v| "#{version}#{v}" }
|
172
|
-
else
|
173
|
-
nil
|
174
175
|
end
|
175
176
|
end
|
176
177
|
|
177
178
|
# :nodoc:
|
178
179
|
def platform_to_str(platform)
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
else
|
183
|
-
nil
|
184
|
-
end
|
180
|
+
return nil unless platform
|
181
|
+
platform = "platform-" if platform.is_a?(TrueClass)
|
182
|
+
"#{platform}#{@platform}"
|
185
183
|
end
|
186
184
|
|
187
185
|
# :nodoc:
|
@@ -41,8 +41,6 @@ module Brauser
|
|
41
41
|
version = extract_version(perform_match(@version_matcher, header))
|
42
42
|
platform = extract_platform(header, engine)
|
43
43
|
[Brauser::Value.new(engine), Brauser::Value.new(version), Brauser::Value.new(platform)]
|
44
|
-
else
|
45
|
-
nil
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
@@ -67,13 +65,13 @@ module Brauser
|
|
67
65
|
|
68
66
|
# :nodoc:
|
69
67
|
def extract_platform(header, engine)
|
70
|
-
catch(:result)
|
68
|
+
catch(:result) do
|
71
69
|
Brauser::Definitions.platforms.each do |platform, definition|
|
72
70
|
throw(:result, platform) if definition.match(header, engine)
|
73
71
|
end
|
74
72
|
|
75
73
|
nil
|
76
|
-
|
74
|
+
end
|
77
75
|
end
|
78
76
|
end
|
79
77
|
end
|
data/lib/brauser/parser.rb
CHANGED
@@ -22,14 +22,14 @@ module Brauser
|
|
22
22
|
# @return [Array|NilClass] An array of engine, version and platform if the match succeeded, `nil` otherwise.
|
23
23
|
def parse_agent(header)
|
24
24
|
# First of all match the agent and the version
|
25
|
-
catch(:result)
|
25
|
+
catch(:result) do
|
26
26
|
Brauser::Definitions.browsers.each do |_, definition|
|
27
27
|
result = definition.match(header)
|
28
28
|
throw(:result, result) if result
|
29
29
|
end
|
30
30
|
|
31
31
|
nil
|
32
|
-
|
32
|
+
end
|
33
33
|
end
|
34
34
|
|
35
35
|
# Parses a Accept-Language header.
|
@@ -37,11 +37,11 @@ module Brauser
|
|
37
37
|
# @param header [String] The Accept-Language header.
|
38
38
|
# @return [Hash] The list of accepted languages with their priorities.
|
39
39
|
def parse_accept_language(header)
|
40
|
-
header.ensure_string.tokenize.reduce({})
|
40
|
+
header.ensure_string.tokenize.reduce({}) do |rv, token|
|
41
41
|
code, priority = token.split(";q=")
|
42
42
|
rv[code.downcase.gsub("_", "-").to_sym] = priority.to_float if code && priority
|
43
43
|
rv
|
44
|
-
|
44
|
+
end
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|