rack-simple_user_agent 0.3.0.rc → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f74e2f39ed2880de537c8ddb79bb621fc4b77779
4
- data.tar.gz: 2ecedea7096e497fd54fecb86492de264c766c37
3
+ metadata.gz: 1075a446c44b68a800c48f7d064a1ffd7300e2e0
4
+ data.tar.gz: 2e84d522efee6815cefe494b34a036ece9e0bcd6
5
5
  SHA512:
6
- metadata.gz: 344ae2ca1235942ee74786d72d6799a57adc230271de3a7cd60b69b0cc16f21e7fce4033e6bcf64d5636271bbc60baa88eaa3667a435456500b1b8de8ec5394e
7
- data.tar.gz: 3aa63f8e36373f64593fd72b25d576400ac139ce789892a16260cc6c263f3497be72e4e48fdd1a0f0ad526a3922b2bb629ee16ad18ad7cecfef4054a775389e9
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.
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class SimpleUserAgent
3
- VERSION = "0.3.0.rc"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -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 smartphone from user-agent string. There is no complicated logic for the detection, it simply checks if user-agent includes particular string.}
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.rc
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-09-24 00:00:00.000000000 Z
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 smartphone
112
- from user-agent string. There is no complicated logic for the detection, it simply
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: 1.3.1
155
+ version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
158
  rubygems_version: 2.5.1