user_agent_info 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +18 -0
- data/Rakefile +14 -0
- data/VERSION +1 -0
- data/doc/classes/ActionController.html +101 -0
- data/doc/classes/ActionController/Request.html +140 -0
- data/doc/classes/ActionController/Request.src/M000001.html +18 -0
- data/doc/classes/UserAgentInfo.html +138 -0
- data/doc/classes/UserAgentInfo/UserAgent.html +234 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000001.html +18 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000002.html +18 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000003.html +18 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000004.html +18 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000005.html +18 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000006.html +18 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000007.html +48 -0
- data/doc/classes/UserAgentInfo/UserAgent.src/M000008.html +48 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/user_agent_info_rb.html +128 -0
- data/doc/fr_class_index.html +29 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +31 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/user_agent_info.rb +189 -0
- data/tests/test_browsers.rb +52 -0
- data/user_agent_info.gemspec +34 -0
- metadata +81 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>[] (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 41</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">lookup</span>)
|
15
|
+
<span class="ruby-ivar">@browser_info</span>[<span class="ruby-identifier">lookup</span>]
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>isIE? (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 52</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isIE?</span>(<span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-identifier">browser_query</span>(<span class="ruby-value str">'MSIE'</span>, <span class="ruby-identifier">version</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>isFirefox? (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 56</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isFirefox?</span>(<span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-identifier">browser_query</span>(<span class="ruby-value str">'Firefox'</span>, <span class="ruby-identifier">version</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>isChrome? (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 60</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isChrome?</span>(<span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-identifier">browser_query</span>(<span class="ruby-value str">'Chrome'</span>, <span class="ruby-identifier">version</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>isOpera? (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 64</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isOpera?</span>(<span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-identifier">browser_query</span>(<span class="ruby-value str">'Opera'</span>, <span class="ruby-identifier">version</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>isOpera? (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 64</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isOpera?</span>(<span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">nil</span>)
|
15
|
+
<span class="ruby-identifier">browser_query</span>(<span class="ruby-value str">'Opera'</span>, <span class="ruby-identifier">version</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>method_missing (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 69</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method_id</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">actions</span> = [<span class="ruby-value str">'better'</span>, <span class="ruby-value str">'worse'</span>]
|
16
|
+
<span class="ruby-identifier">operators</span> = [<span class="ruby-value str">'or'</span>, <span class="ruby-value str">'and'</span>]
|
17
|
+
|
18
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">method_id</span>.<span class="ruby-identifier">to_s</span>
|
19
|
+
<span class="ruby-identifier">method_name</span> = <span class="ruby-node">"#{method.split('_')[0]}?"</span>
|
20
|
+
|
21
|
+
<span class="ruby-identifier">operator</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'_'</span>)[<span class="ruby-value">1</span>]
|
22
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'_'</span>)[<span class="ruby-value">2</span>].<span class="ruby-identifier">chop</span>
|
23
|
+
|
24
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">operators</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">operator</span>)
|
25
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">action</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">action</span>)
|
26
|
+
|
27
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_sym</span>
|
28
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>
|
29
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">"Missing 'version' argument."</span>
|
30
|
+
<span class="ruby-keyword kw">end</span>
|
31
|
+
|
32
|
+
<span class="ruby-identifier">version</span> = <span class="ruby-identifier">arguments</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_f</span>
|
33
|
+
<span class="ruby-keyword kw">case</span>
|
34
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"better"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'or'</span>)
|
35
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator">>=</span> <span class="ruby-identifier">version</span>
|
36
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"better"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'and'</span>)
|
37
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator">></span> <span class="ruby-identifier">version</span>
|
38
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"worse"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'or'</span>)
|
39
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">version</span>
|
40
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"worse"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'and'</span>)
|
41
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator"><</span> <span class="ruby-identifier">version</span>
|
42
|
+
<span class="ruby-keyword kw">end</span>
|
43
|
+
<span class="ruby-keyword kw">end</span>
|
44
|
+
|
45
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
46
|
+
<span class="ruby-keyword kw">end</span></pre>
|
47
|
+
</body>
|
48
|
+
</html>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>method_missing (UserAgentInfo::UserAgent)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/user_agent_info.rb, line 70</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">method_id</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">arguments</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">actions</span> = [<span class="ruby-value str">'better'</span>, <span class="ruby-value str">'worse'</span>]
|
16
|
+
<span class="ruby-identifier">operators</span> = [<span class="ruby-value str">'or'</span>, <span class="ruby-value str">'and'</span>]
|
17
|
+
|
18
|
+
<span class="ruby-identifier">method</span> = <span class="ruby-identifier">method_id</span>.<span class="ruby-identifier">to_s</span>
|
19
|
+
<span class="ruby-identifier">method_name</span> = <span class="ruby-node">"#{method.split('_')[0]}?"</span>
|
20
|
+
|
21
|
+
<span class="ruby-identifier">operator</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'_'</span>)[<span class="ruby-value">1</span>]
|
22
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'_'</span>)[<span class="ruby-value">2</span>].<span class="ruby-identifier">chop</span>
|
23
|
+
|
24
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">operators</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">operator</span>)
|
25
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">action</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">action</span>)
|
26
|
+
|
27
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_sym</span>
|
28
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arguments</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-value">1</span>
|
29
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">"Missing 'version' argument."</span>
|
30
|
+
<span class="ruby-keyword kw">end</span>
|
31
|
+
|
32
|
+
<span class="ruby-identifier">version</span> = <span class="ruby-identifier">arguments</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_f</span>
|
33
|
+
<span class="ruby-keyword kw">case</span>
|
34
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"better"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'or'</span>)
|
35
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator">>=</span> <span class="ruby-identifier">version</span>
|
36
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"better"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'and'</span>)
|
37
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator">></span> <span class="ruby-identifier">version</span>
|
38
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"worse"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'or'</span>)
|
39
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">version</span>
|
40
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">"worse"</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">eql?</span>(<span class="ruby-value str">'and'</span>)
|
41
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@browser_info</span>[<span class="ruby-value str">'version'</span>] <span class="ruby-operator"><</span> <span class="ruby-identifier">version</span>
|
42
|
+
<span class="ruby-keyword kw">end</span>
|
43
|
+
<span class="ruby-keyword kw">end</span>
|
44
|
+
|
45
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
46
|
+
<span class="ruby-keyword kw">end</span></pre>
|
47
|
+
</body>
|
48
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Fri, 06 Nov 2009 12:59:14 +0100
|
@@ -0,0 +1,128 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: user_agent_info.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>user_agent_info.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/user_agent_info.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Fri Nov 06 12:59:10 +0100 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1><a href="../../classes/UserAgentInfo.html">UserAgentInfo</a></h1>
|
73
|
+
<h2>simplify user-agent detection in Rails</h2>
|
74
|
+
<table>
|
75
|
+
<tr><td valign="top">Author:</td><td>Mehmet Celik
|
76
|
+
|
77
|
+
</td></tr>
|
78
|
+
</table>
|
79
|
+
<h2>Usage</h2>
|
80
|
+
<p>
|
81
|
+
It extends ActionController::Request and parses the requests
|
82
|
+
HTTP_USER_AGENT header so it can be queried. The supported browsers are IE,
|
83
|
+
Firefox, Chrome, Opera this translates into the methods isIE?, isFirefox?,
|
84
|
+
isChrome, isOpera? You can also supply a version like
|
85
|
+
isIE?(‘6.0’) and you can query if it is worse or/and better
|
86
|
+
then a version isIE_or_worse?(‘6.0’)
|
87
|
+
</p>
|
88
|
+
<h3>Example</h3>
|
89
|
+
<pre>
|
90
|
+
class UpgradeBrowserController < ApplicationController
|
91
|
+
def index
|
92
|
+
@upgrade = request.user_agent_info.isIE_or_worse?('6.0')
|
93
|
+
end
|
94
|
+
end
|
95
|
+
</pre>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
|
106
|
+
<!-- if includes -->
|
107
|
+
|
108
|
+
<div id="section">
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<!-- if method_list -->
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
<div id="validator-badges">
|
124
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
</body>
|
128
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/ActionController.html">ActionController</a><br />
|
24
|
+
<a href="classes/UserAgentInfo.html">UserAgentInfo</a><br />
|
25
|
+
<a href="classes/UserAgentInfo/UserAgent.html">UserAgentInfo::UserAgent</a><br />
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Files
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Files</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Files</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="files/lib/user_agent_info_rb.html">lib/user_agent_info.rb</a><br />
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/UserAgentInfo/UserAgent.html#M000001">[] (UserAgentInfo::UserAgent)</a><br />
|
24
|
+
<a href="classes/UserAgentInfo/UserAgent.html#M000004">isChrome? (UserAgentInfo::UserAgent)</a><br />
|
25
|
+
<a href="classes/UserAgentInfo/UserAgent.html#M000003">isFirefox? (UserAgentInfo::UserAgent)</a><br />
|
26
|
+
<a href="classes/UserAgentInfo/UserAgent.html#M000002">isIE? (UserAgentInfo::UserAgent)</a><br />
|
27
|
+
<a href="classes/UserAgentInfo/UserAgent.html#M000005">isOpera? (UserAgentInfo::UserAgent)</a><br />
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</body>
|
31
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
RDoc Documentation
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>RDoc Documentation</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/lib/user_agent_info_rb.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|