mobile_fu-rails3 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,9 +57,7 @@ module MobileFu
57
57
  # the user has opted to use either the 'Standard' view or 'Mobile' view.
58
58
  def set_mobile_format
59
59
  session[:mobile_view] ||= is_mobile_device? ? true : false
60
- if session[:mobile_view] and request.format.html? and not request.xhr?
61
- request.format = :mobile
62
- end
60
+ request.format = :mobile if session[:mobile_view] and request.format.html? and not request.xhr?
63
61
  end
64
62
 
65
63
  # Returns either true or false depending on whether or not the format of the
@@ -71,13 +69,13 @@ module MobileFu
71
69
  # Returns either true or false depending on whether or not the user agent of
72
70
  # the device making the request is matched to a device in our regex.
73
71
  def is_mobile_device?
74
- !!(request.user_agent.downcase =~ Regexp.new(MobileFu::ActionController::MOBILE_USER_AGENTS))
72
+ !!(request.user_agent.to_s.downcase =~ Regexp.new(MobileFu::ActionController::MOBILE_USER_AGENTS))
75
73
  end
76
74
 
77
75
  # Can check for a specific user agent
78
76
  # e.g., is_device?('iphone') or is_device?(:mobileexplorer)
79
77
  def is_device?(type)
80
- request.user_agent.downcase.include?(type.to_s.downcase)
78
+ request.user_agent.to_s.downcase.include?(type.to_s.downcase)
81
79
  end
82
80
  end
83
81
  end
@@ -8,8 +8,8 @@ module MobileFu
8
8
  raise Exception.new("MobileFu: XHTML DOCTYPE version must be in the format of '1.0' or '1.1', etc.") unless version.include?('.')
9
9
 
10
10
  doc_type = "<?xml version=\"1.0\" charset=\"UTF-8\" ?>\n"
11
- doc_type += "<!DOCTYPE html PUBLIC "
12
- doc_type += case type
11
+ doc_type << "<!DOCTYPE html PUBLIC "
12
+ doc_type << case type
13
13
  when :mobile
14
14
  "\"-//WAPFORUM//DTD XHTML Mobile #{version}//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile#{version.gsub('.','')}.dtd\">"
15
15
  when :basic
@@ -26,7 +26,7 @@ module MobileFu
26
26
  # with modification to work for mobile browsers.
27
27
  def user_agent_device_name
28
28
  @user_agent_device_name ||= begin
29
- ua = request.user_agent
29
+ ua = request.user_agent.to_s
30
30
  return nil if ua.nil?
31
31
  ua.downcase!
32
32
 
Binary file
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "mobile_fu-rails3"
6
- s.version = "1.0.5"
6
+ s.version = "1.0.6"
7
7
  s.authors = ["Brendan Lim", "Jori Hardman"]
8
8
  s.email = ["brendangl@gmail.com", "jorihardman@gmail.com"]
9
9
  s.homepage = "https://github.com/jyro215/mobile-fu"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobile_fu-rails3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-05 00:00:00.000000000 -07:00
14
- default_executable:
13
+ date: 2011-08-22 00:00:00.000000000Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rails
18
- requirement: &2165422520 !ruby/object:Gem::Requirement
17
+ requirement: &2152914700 !ruby/object:Gem::Requirement
19
18
  none: false
20
19
  requirements:
21
20
  - - ! '>='
@@ -23,7 +22,7 @@ dependencies:
23
22
  version: 3.0.0
24
23
  type: :runtime
25
24
  prerelease: false
26
- version_requirements: *2165422520
25
+ version_requirements: *2152914700
27
26
  description: This is a rewrite of the mobile-fu gem using Rails 3 railties.
28
27
  email:
29
28
  - brendangl@gmail.com
@@ -42,9 +41,8 @@ files:
42
41
  - lib/mobile_fu/helper_methods.rb
43
42
  - lib/mobile_fu/mobilized_styles.rb
44
43
  - lib/mobile_fu/railtie.rb
45
- - mobile_fu-rails3-1.0.4.gem
44
+ - mobile_fu-rails3-1.0.5.gem
46
45
  - mobile_fu-rails3.gemspec
47
- has_rdoc: true
48
46
  homepage: https://github.com/jyro215/mobile-fu
49
47
  licenses: []
50
48
  post_install_message:
@@ -65,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
63
  version: '0'
66
64
  requirements: []
67
65
  rubyforge_project: mobile_fu-rails3
68
- rubygems_version: 1.6.2
66
+ rubygems_version: 1.8.6
69
67
  signing_key:
70
68
  specification_version: 3
71
69
  summary: Easily handling of mobile requests in action controller.
Binary file