is_it_mobile 1.0.0 → 1.0.0.1
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.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/lib/is_it_mobile.rb +4 -3
- data/test/test_is_it_mobile.rb +12 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
|
Binary file
|
data/History.txt
CHANGED
data/lib/is_it_mobile.rb
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
class IsItMobile
|
|
2
|
-
VERSION = '1.0.0'
|
|
2
|
+
VERSION = '1.0.0.1'
|
|
3
3
|
|
|
4
4
|
POPULAR_MOBILE_USER_AGENT_BEGINNINGS = ['w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac', 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno','ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-', 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-','newt','noki','oper','palm','pana','pant','phil','play','port','prox', 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar','sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-', 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp','wapr','webc','winw','winw','xda','xda-']
|
|
5
5
|
|
|
6
6
|
module ForRails
|
|
7
|
-
def included
|
|
7
|
+
def self.included(base)
|
|
8
8
|
base.class_eval do
|
|
9
9
|
before_filter :wrangle_format_if_request_is_mobile
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
protected
|
|
13
14
|
def wrangle_format_if_request_is_mobile
|
|
14
|
-
request.format = :mobile if IsItMobile.mobile?(
|
|
15
|
+
request.format = :mobile if IsItMobile.mobile?( request.env['HTTP_USER_AGENT'], request.env['HTTP_ACCEPT'])
|
|
15
16
|
end
|
|
16
17
|
end
|
|
17
18
|
|
data/test/test_is_it_mobile.rb
CHANGED
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|