is_it_mobile 1.0.0.1 → 1.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data.tar.gz.sig +0 -0
  2. data/lib/is_it_mobile.rb +3 -3
  3. metadata +1 -1
  4. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/lib/is_it_mobile.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class IsItMobile
2
- VERSION = '1.0.0.1'
2
+ VERSION = '1.0.0.2'
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
 
@@ -12,12 +12,12 @@ class IsItMobile
12
12
 
13
13
  protected
14
14
  def wrangle_format_if_request_is_mobile
15
- request.format = :mobile if IsItMobile.mobile?( request.env['HTTP_USER_AGENT'], request.env['HTTP_ACCEPT'])
15
+ request.format = :mobile if IsItMobile.mobile?( request.env['HTTP_USER_AGENT'] || '', request.env['HTTP_ACCEPT'] || '' )
16
16
  end
17
17
  end
18
18
 
19
19
  # Check if the given user agent is for a mobile device.
20
- def self.mobile?( user_agent, accepts = '' )
20
+ def self.mobile?( user_agent, accepts )
21
21
  return !!( user_agent =~ /(mobile|up.browser|up.link|mmp|symbian|phone|midp|wap|mini|ppc;|playstation|palm|wii|nitro)/i ||
22
22
  accepts.index('application/vnd.wap.xhtml+xml') ||
23
23
  POPULAR_MOBILE_USER_AGENT_BEGINNINGS.include?(user_agent[0,4]))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_it_mobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1
4
+ version: 1.0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Myron
metadata.gz.sig CHANGED
Binary file