rack-useragent-filter 0.1.8 → 0.1.9
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.
- data/VERSION +1 -1
- data/lib/rack/useragent/filter.rb +3 -3
- data/rack-useragent-filter.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
@@ -6,7 +6,7 @@ require 'ostruct'
|
|
6
6
|
module Rack
|
7
7
|
module UserAgent
|
8
8
|
class Filter
|
9
|
-
|
9
|
+
|
10
10
|
def initialize(app, required_browsers = [], options = {})
|
11
11
|
@app = app
|
12
12
|
@browsers = required_browsers.map{ |b| OpenStruct.new(:browser => b[0], :version => b[1]) }
|
@@ -19,7 +19,7 @@ module Rack
|
|
19
19
|
useragent = ::UserAgent.parse(env["HTTP_USER_AGENT"].to_s)
|
20
20
|
if useragent.any? && !detection_disabled_by_cookie?(request.cookies) && unsupported?(useragent)
|
21
21
|
content = render_page(useragent)
|
22
|
-
[
|
22
|
+
[200, {"Content-Type" => "text/html", "Content-Length" => content.length.to_s}, content]
|
23
23
|
else
|
24
24
|
@app.call(env)
|
25
25
|
end
|
@@ -40,7 +40,7 @@ module Rack
|
|
40
40
|
@browser = useragent # for the template
|
41
41
|
Tilt.new(@template).render(self)
|
42
42
|
else
|
43
|
-
"Sorry, your browser is not supported. Please upgrade"
|
43
|
+
"Sorry, your browser is not supported. Please upgrade"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rack-useragent-filter}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tomasz Mazur", "Sergio Gil", "Luismi Cavall\303\251"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-14}
|
13
13
|
s.email = %q{defkode@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.rdoc"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-useragent-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tomasz Mazur
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-10-14 00:00:00 +02:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|