rack-simple_user_agent 0.3.0.rc → 0.3.0
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/README.md +25 -0
- data/lib/rack/simple_user_agent/version.rb +1 -1
- data/rack-simple_user_agent.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1075a446c44b68a800c48f7d064a1ffd7300e2e0
|
4
|
+
data.tar.gz: 2e84d522efee6815cefe494b34a036ece9e0bcd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b418ac442b11fe96b08a4073098742c0ed93a6257c94adb74b0df948047523ce93846f7acb6f0da0ecbfbc9426d3f5cedda4033508c4dcbf3191f9114daf184a
|
7
|
+
data.tar.gz: baf87c9a581a407ede45fdfff526cd93e365b7b6f78ec793557418c6dde3c02cf323c38173d8781bd282f4f222458cc9d078d2110733e1566b2c132fbd115681
|
data/README.md
CHANGED
@@ -46,8 +46,27 @@ request ─ from_smartdevice?
|
|
46
46
|
|
47
47
|
Installing `rack-simple_user_agent` automatically makes all detection methods available.
|
48
48
|
|
49
|
+
#### Action Pack Variants Usage
|
50
|
+
|
49
51
|
These methods are useful when you use the Rails' [Action Pack Variants](http://guides.rubyonrails.org/4_1_release_notes.html#action-pack-variants) (as of Rails4.1).
|
50
52
|
|
53
|
+
```rb
|
54
|
+
class ApplicationController < ActionController::Base
|
55
|
+
before_action :set_request_variant
|
56
|
+
|
57
|
+
def set_request_variant
|
58
|
+
request.variant = :smartphone if request.from_smartphone?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
Then, you can use two types of view. For example:
|
64
|
+
|
65
|
+
```
|
66
|
+
app/views/projects/show.html.erb
|
67
|
+
app/views/projects/show.html+smartphone.erb
|
68
|
+
```
|
69
|
+
|
51
70
|
### on Sinatra
|
52
71
|
|
53
72
|
```rb
|
@@ -69,6 +88,12 @@ get "/" do
|
|
69
88
|
end
|
70
89
|
```
|
71
90
|
|
91
|
+
## Testing
|
92
|
+
|
93
|
+
```bash
|
94
|
+
bundle exec rake test
|
95
|
+
```
|
96
|
+
|
72
97
|
## Development
|
73
98
|
|
74
99
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["me@toshimaru.net"]
|
10
10
|
|
11
11
|
spec.summary = %q{Rack::SimpleUserAgent is stupidly simple UA detector}
|
12
|
-
spec.description = %q{Rack::SimpleUserAgent is Rack::Request extension which detects
|
12
|
+
spec.description = %q{Rack::SimpleUserAgent is Rack::Request extension which detects user-agent from user-agent string. No complicated logic for the detection, it simply(stupidly) checks if user-agent includes particular string or not.}
|
13
13
|
spec.homepage = "https://github.com/toshimaru/rack-simple_user_agent"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-simple_user_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toshimaru
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,9 +108,9 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description: Rack::SimpleUserAgent is Rack::Request extension which detects
|
112
|
-
from user-agent string.
|
113
|
-
checks if user-agent includes particular string.
|
111
|
+
description: Rack::SimpleUserAgent is Rack::Request extension which detects user-agent
|
112
|
+
from user-agent string. No complicated logic for the detection, it simply(stupidly)
|
113
|
+
checks if user-agent includes particular string or not.
|
114
114
|
email:
|
115
115
|
- me@toshimaru.net
|
116
116
|
executables: []
|
@@ -150,9 +150,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
155
|
+
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
158
|
rubygems_version: 2.5.1
|