guilded 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ = 1.0.1 2009-10-19
2
+
3
+ * Moved the browser detector to its own Gem.
4
+
5
+
1
6
  = 1.0.0 2009-10-15
2
7
 
3
8
  * It's about time for a 1.0.0 release
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = guilded
2
2
 
3
- http://github.com/midas/guilded/tree/master
3
+ http://github.com/midas/guilded
4
4
 
5
5
 
6
6
  == DESCRIPTION
@@ -77,7 +77,6 @@ have decided to include support for it in Guilded as of release 0.3.0.
77
77
  an unpacked version of the file.
78
78
 
79
79
  === Additional common utilities
80
- * Determine the browser making a request with the BrowserDetector class and related view helpers.
81
80
  * Extends ActiveRecord to have a attr_human_hint method. This method works similar to the attr_human_name method except a hint
82
81
  to use on forms, etc is being set.
83
82
  * Extends InactiveRecord (http://github.com/midas/inactive_record/tree/master) to include the attr_human_hint method.
@@ -112,15 +111,15 @@ have decided to include support for it in Guilded as of release 0.3.0.
112
111
 
113
112
  == INSTALL
114
113
 
115
- gem sources -a http://gems.github.com
116
- sudo gem install midas-guilded
114
+ gem sources -a http://gemcutter.org
115
+ sudo gem install guilded
117
116
 
118
117
 
119
118
  == INSTALL FOR RAILS
120
119
 
121
120
  Add to environment file:
122
121
 
123
- config.gem "guilded", :version => '1.0.0'
122
+ config.gem "guilded", :version => '1.0.0', :source => 'http://gemcutter.org'
124
123
 
125
124
  Run:
126
125
 
@@ -165,46 +164,6 @@ filter in your application controller:
165
164
 
166
165
  Then install one or more Guilded components and you are on your way!
167
166
 
168
- === BROWSER DETECTOR
169
-
170
- The browser detector uses the HTTP user agent string to determine which browser is making the current request. The detector
171
- can determine the name, version, major version, minor version, build version and revision version of the current browser.
172
-
173
- If using Rails, there are several view helpers available that use the BrowserDetector: g_browser_name(), g_browser_version(),
174
- g_browser_full_name() and g_browser_is?().
175
-
176
- The following examples will assume Firefox 3.5.3 on OS/X is being used. The user agent string for Firefox 3.5.3 on OS/X is:
177
-
178
- Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
179
-
180
- g_browser_name
181
-
182
- <% if g_browser_name == 'firefox' %>
183
- ...
184
-
185
- g_browser_version
186
-
187
- <% if g_browser_version == '3.5.3' %>
188
- ...
189
-
190
- g_browser_full_name
191
-
192
- <%= g_browser_full_name # Outputs: Firefox 3.5.3 %>
193
-
194
- g_browser_is?
195
-
196
- <% if g_browser_is?( :name => 'firefox', :version => '3.5.3' ) %>
197
- ...
198
-
199
- <% if g_browser_is?( :name => 'firefox', :major_version => '3' ) %>
200
- ...
201
-
202
- <% if g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3 ) %>
203
- ...
204
-
205
- <% if g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3, :revision_version => 0 ) %>
206
- ...
207
-
208
167
 
209
168
  == LICENSE
210
169
 
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ begin
10
10
  gem.email = "jason@lookforwardenterprises.com"
11
11
  gem.homepage = "http://github.com/midas/guilded"
12
12
  gem.authors = ["C. Jason Harrelson (midas)"]
13
+ gem.add_development_dependency "shoulda", ">= 2.10.2"
13
14
  gem.add_dependency "activesupport", ">= 2.0.2"
14
15
  end
15
16
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/guilded.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{guilded}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["C. Jason Harrelson (midas)"]
12
- s.date = %q{2009-10-17}
12
+ s.date = %q{2009-10-19}
13
13
  s.description = %q{Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal (HTML, CSS and JavaScript) to do as it was intended.}
14
14
  s.email = %q{jason@lookforwardenterprises.com}
15
15
  s.extra_rdoc_files = [
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  "VERSION",
24
24
  "guilded.gemspec",
25
25
  "lib/guilded.rb",
26
- "lib/guilded/browser_detector.rb",
27
26
  "lib/guilded/component_def.rb",
28
27
  "lib/guilded/exceptions.rb",
29
28
  "lib/guilded/guilder.rb",
@@ -52,7 +51,6 @@ Gem::Specification.new do |s|
52
51
  "script/generate",
53
52
  "tasks/rails.rake",
54
53
  "tasks/rspec.rake",
55
- "test/guilded/browser_detector_test.rb",
56
54
  "test/guilded/component_def_test.rb",
57
55
  "test/guilded/guilder_test.rb",
58
56
  "test/guilded/rails/helpers_test.rb",
@@ -66,8 +64,7 @@ Gem::Specification.new do |s|
66
64
  s.rubygems_version = %q{1.3.5}
67
65
  s.summary = %q{A framework for building web based components centered around current web standards and best practices.}
68
66
  s.test_files = [
69
- "test/guilded/browser_detector_test.rb",
70
- "test/guilded/component_def_test.rb",
67
+ "test/guilded/component_def_test.rb",
71
68
  "test/guilded/guilder_test.rb",
72
69
  "test/guilded/rails/helpers_test.rb",
73
70
  "test/guilded/rails/view_helpers_test.rb",
@@ -80,11 +77,14 @@ Gem::Specification.new do |s|
80
77
  s.specification_version = 3
81
78
 
82
79
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
80
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
83
81
  s.add_runtime_dependency(%q<activesupport>, [">= 2.0.2"])
84
82
  else
83
+ s.add_dependency(%q<shoulda>, [">= 2.10.2"])
85
84
  s.add_dependency(%q<activesupport>, [">= 2.0.2"])
86
85
  end
87
86
  else
87
+ s.add_dependency(%q<shoulda>, [">= 2.10.2"])
88
88
  s.add_dependency(%q<activesupport>, [">= 2.0.2"])
89
89
  end
90
90
  end
data/lib/guilded.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
- require 'guilded/browser_detector'
5
4
  require 'guilded/component_def'
6
5
  require 'guilded/guilder'
7
6
  require 'guilded/exceptions'
@@ -73,7 +72,7 @@ require 'guilded/rails/inactive_record/human_attribute_hint'
73
72
  # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %>
74
73
  #
75
74
  module Guilded
76
- VERSION = '0.3.0'
75
+ VERSION = '1.0.1'
77
76
  end
78
77
 
79
78
  ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -97,51 +97,7 @@ module Guilded
97
97
  ""
98
98
  end
99
99
  end
100
-
101
- # Returns the name of the browser that is making this request. For example 'ie'. When using
102
- # the browser detector in the contoller you may put a :g_browser_detector variabe in the session if
103
- # you wish to keep the BrowserDetector from being instantiated more than once per request.
104
- #
105
- def g_browser_name
106
- @g_browser_detector = session[:g_browser_detector] if respond_to?( :session )
107
- @g_browser_detector ||= Guilded::BrowserDetector.new( request.env['HTTP_USER_AGENT'] )
108
- @g_browser_detector.browser_name
109
- end
110
-
111
- # Returns the version of the browser that is making this request. For example '7'. When using
112
- # the browser detector in the contoller you may put a :g_browser_detector variabe in the session if
113
- # you wish to keep the BrowserDetector from being instantiated more than once per request.
114
- #
115
- def g_browser_version
116
- @g_browser_detector = session[:g_browser_detector] if respond_to?( :session )
117
- @g_browser_detector ||= Guilded::BrowserDetector.new( request.env['HTTP_USER_AGENT'] )
118
- @g_browser_detector.browser_version
119
- end
120
-
121
- # Returns the browser name concatenated with the browser version. for example, 'ie7'. When using
122
- # the browser detector in the contoller you may put a :g_browser_detector variabe in the session if
123
- # you wish to keep the BrowserDetector from being instantiated more than once per request.
124
- #
125
- def g_browser_full_name
126
- @g_browser_detector = session[:g_browser_detector] if respond_to?( :session )
127
- @g_browser_detector ||= Guilded::BrowserDetector.new( request.env['HTTP_USER_AGENT'] )
128
- @g_browser_detector.browser_full_name
129
- end
130
-
131
- # Returns true if the browser matches the options ent in, otherwise returns false. When using
132
- # the browser detector in the contoller you may put a :g_browser_detector variabe in the session if
133
- # you wish to keep the BrowserDetector from being instantiated more than once per request.
134
- #
135
- # === Options
136
- # * +:name+ - The name of the browser. For example 'ie'.
137
- # * +:version+ - The version of the browser. For example '7'.
138
- #
139
- def g_browser_is?( options={} )
140
- @g_browser_detector = session[:g_browser_detector] if respond_to?( :session )
141
- @g_browser_detector ||= Guilded::BrowserDetector.new( request.env['HTTP_USER_AGENT'] )
142
- @g_browser_detector.browser_is?( options )
143
- end
144
-
100
+
145
101
  end
146
102
  end
147
103
  end
@@ -2,96 +2,8 @@ require 'test_helper'
2
2
 
3
3
  class ViewHelpersTest < Test::Unit::TestCase
4
4
 
5
- context "The browser detector view helpers" do
6
- setup do
7
- @view = View.new
8
- end
9
-
10
- should "resolve the correct browser name" do
11
- assert_equal 'firefox', @view.g_browser_name
12
- end
13
-
14
- should "resolve the correct g_browser_version" do
15
- assert_equal '3.5.3', @view.g_browser_version
16
- end
17
-
18
- should "resolve the correct g_browser_full_name" do
19
- assert_equal 'Firefox 3.5.3', @view.g_browser_full_name
20
- end
21
-
22
- should "resolve the correct g_browser_version" do
23
- assert_equal '3.5.3', @view.g_browser_version
24
- end
25
-
26
- should "agree that the browser is :name => :firefox" do
27
- assert @view.g_browser_is?( :name => :firefox )
28
- end
29
-
30
- should "agree that the browser is :version => '3.5.3'" do
31
- assert @view.g_browser_is?( :version => '3.5.3' )
32
- end
33
-
34
- should "agree that the browser is :name => :firefox, :version => '3.5.3'" do
35
- assert @view.g_browser_is?( :name => :firefox, :version => '3.5.3' )
36
- end
37
-
38
- should "agree that the browser is :name => :firefox, :major_version => '3'" do
39
- assert @view.g_browser_is?( :name => :firefox, :major_version => '3' )
40
- end
41
-
42
- should "agree that the browser is :name => :firefox, :minor_version => '5'" do
43
- assert @view.g_browser_is?( :name => :firefox, :minor_version => '5' )
44
- end
45
-
46
- should "agree that the browser is :name => :firefox, :build_version => '3'" do
47
- assert @view.g_browser_is?( :name => :firefox, :build_version => '3' )
48
- end
49
-
50
- should "agree that the browser is :name => :firefox, :revision_version => '0'" do
51
- assert @view.g_browser_is?( :name => :firefox, :revision_version => '0' )
52
- end
53
-
54
- should "agree that the browser is :name => :firefox, :major_version => '3', :minor_version => '5'" do
55
- assert @view.g_browser_is?( :name => :firefox, :major_version => '3', :minor_version => '5' )
56
- end
57
-
58
- should "agree that the browser is :name => :firefox, :major_version => '3', :minor_version => '5', :build_version => '3'" do
59
- assert @view.g_browser_is?( :name => :firefox, :major_version => '3', :minor_version => '5', :build_version => '3' )
60
- end
61
-
62
- should "agree that the browser is :name => :firefox, :major_version => '3', :minor_version => '5', :build_version => '3', :revision_version => '0'" do
63
- assert @view.g_browser_is?( :name => :firefox, :major_version => '3', :minor_version => '5', :build_version => '3',
64
- :revision_version => '0' )
65
- end
66
-
67
- should "agree that the browser is :name => :firefox, :major_version => 3" do
68
- assert @view.g_browser_is?( :name => :firefox, :major_version => 3 )
69
- end
70
-
71
- should "agree that the browser is :name => :firefox, :minor_version => 5" do
72
- assert @view.g_browser_is?( :name => :firefox, :minor_version => 5 )
73
- end
74
-
75
- should "agree that the browser is :name => :firefox, :build_version => 3" do
76
- assert @view.g_browser_is?( :name => :firefox, :build_version => 3 )
77
- end
78
-
79
- should "agree that the browser is :name => :firefox, :revision_version => 0" do
80
- assert @view.g_browser_is?( :name => :firefox, :revision_version => 0 )
81
- end
82
-
83
- should "agree that the browser is :name => :firefox, :major_version => 3, :minor_version => 5" do
84
- assert @view.g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5 )
85
- end
86
-
87
- should "agree that the browser is :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3" do
88
- assert @view.g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3 )
89
- end
90
-
91
- should "agree that the browser is :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3, :revision_version => 0" do
92
- assert @view.g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3,
93
- :revision_version => '0' )
94
- end
5
+ should "be true" do
6
+ assert true
95
7
  end
96
8
 
97
9
  end
data/test/test_helper.rb CHANGED
@@ -36,12 +36,4 @@ class View
36
36
  @request = Request.new
37
37
  end
38
38
  end
39
- View.send( :include, Guilded::Rails::ViewHelpers )
40
-
41
- class Request
42
- attr_accessor :env
43
-
44
- def initialize
45
- @env = { 'HTTP_USER_AGENT' => Guilded::BrowserDetector.user_agents[:firefox35] }
46
- end
47
- end
39
+ View.send( :include, Guilded::Rails::ViewHelpers )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guilded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas)
@@ -9,9 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-17 00:00:00 -05:00
12
+ date: 2009-10-19 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.10.2
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: activesupport
17
27
  type: :runtime
@@ -38,7 +48,6 @@ files:
38
48
  - VERSION
39
49
  - guilded.gemspec
40
50
  - lib/guilded.rb
41
- - lib/guilded/browser_detector.rb
42
51
  - lib/guilded/component_def.rb
43
52
  - lib/guilded/exceptions.rb
44
53
  - lib/guilded/guilder.rb
@@ -67,7 +76,6 @@ files:
67
76
  - script/generate
68
77
  - tasks/rails.rake
69
78
  - tasks/rspec.rake
70
- - test/guilded/browser_detector_test.rb
71
79
  - test/guilded/component_def_test.rb
72
80
  - test/guilded/guilder_test.rb
73
81
  - test/guilded/rails/helpers_test.rb
@@ -103,7 +111,6 @@ signing_key:
103
111
  specification_version: 3
104
112
  summary: A framework for building web based components centered around current web standards and best practices.
105
113
  test_files:
106
- - test/guilded/browser_detector_test.rb
107
114
  - test/guilded/component_def_test.rb
108
115
  - test/guilded/guilder_test.rb
109
116
  - test/guilded/rails/helpers_test.rb
@@ -1,217 +0,0 @@
1
- module Guilded
2
-
3
- # The BrowserDetector provides the ability to determine browser information from the user
4
- # agent string.
5
- #
6
- class BrowserDetector
7
-
8
- attr_reader :ua
9
-
10
- def initialize( user_agent )
11
- @ua = user_agent.downcase
12
- @version_regex = /(\d*)\.(\d*)\.*(\d*)\.*(\d*)/
13
- end
14
-
15
- # Returns true if the browser matches the options ent in, otherwise returns false.
16
- #
17
- # === Request
18
- # * +request+ - The request object.
19
- #
20
- # === Options
21
- # * +:name+ - The name of the browser. For example 'ie' or :ie.
22
- # * +:version+ - The version of the browser. For example '3.0.5'.
23
- # * +:major_version+ - The major version of the browser. For example '3' or 3.
24
- # * +:minor_version+ - The minor version of the browser. For example '0' or 0.
25
- #
26
- def browser_is?( options={} )
27
- name = options[:name]
28
- version = options[:version]
29
- major_version = options[:major_version]
30
- minor_version = options[:minor_version]
31
- build_version = options[:build_version]
32
- revision_version = options[:revision_version]
33
-
34
- name ||= self.browser_name
35
- version ||= self.browser_version
36
- major_version ||= self.browser_version_major
37
- minor_version ||= self.browser_version_minor
38
- build_version ||= self.browser_version_build
39
- revision_version ||= self.browser_version_revision
40
-
41
- name = name.to_s.strip
42
- version = version.to_s.strip
43
- major_version = major_version.to_s.strip
44
- minor_version = minor_version.to_s.strip
45
- build_version = build_version.to_s.strip
46
- revision_version = revision_version.to_s.strip
47
-
48
- self.browser_name == name && self.browser_version == version && self.browser_version_major == major_version &&
49
- self.browser_version_minor == minor_version #&& self.browser_version_build == build_version &&
50
- #self.browser_version_revision == revision_version
51
- end
52
-
53
- # Returns the name of the browser that is making this request. For example 'ie'.
54
- #
55
- # === Request
56
- # * +request+ - The request object.
57
- #
58
- def browser_name
59
- begin
60
- @browser_name ||= begin
61
- ua = @ua
62
- if ua.nil?
63
- 'unknown'
64
- else
65
- if ua.index( 'msie' ) && !ua.index( 'opera' ) && !ua.index( 'webtv' )
66
- if ua.index( 'windows ce' )
67
- 'ie' + '_ce' #+ ua[ua.index( 'msie' ) + 5].chr
68
- else
69
- 'ie' # + ua[ua.index( 'msie' ) + 5].chr
70
- end
71
- elsif ua.include?( 'opera' )
72
- 'opera'
73
- elsif ua.include?( 'konqueror' )
74
- 'konqueror'
75
- elsif ua.include?( 'applewebkit/' )
76
- 'safari'
77
- elsif ua.include?( 'chrome' )
78
- 'chrome'
79
- #elsif ua.include?( 'mozilla/' )
80
- # 'firefox'
81
- elsif ua.include?( 'firefox' )
82
- 'firefox'
83
- #elsif ua.include?( 'gecko/' )
84
- # 'firefox'
85
- elsif ua.include?( 'netscape' )
86
- 'netscape'
87
- else
88
- 'unknown'
89
- end
90
- end
91
- end
92
- rescue
93
- 'unknown'
94
- end
95
- end
96
-
97
- # Returns the version of the browser that is making this request. For example '7'.
98
- #
99
- # === Request
100
- # * +request+ - The request object.
101
- #
102
- def browser_version
103
- @browser_version ||= begin
104
- self.send( "resolve_version_for_#{self.browser_name}".to_sym )
105
- end
106
- end
107
-
108
- def browser_version_major
109
- match = @version_regex.match( browser_version )
110
- return match[1].to_i.to_s unless match.nil? || match.size < 2
111
- '0'
112
- end
113
-
114
- def browser_version_minor
115
- match = @version_regex.match( browser_version )
116
- return match[2].to_i.to_s unless match.nil? || match.size < 3
117
- '0'
118
- end
119
-
120
- def browser_version_build
121
- match = @version_regex.match( browser_version )
122
- return match[3].to_i.to_s unless match.nil? || match.size < 4 || match[3].empty? || match[3].nil?
123
- '0'
124
- end
125
-
126
- def browser_version_revision
127
- match = @version_regex.match( browser_version )
128
- return match[4].to_i.to_s unless match.nil? || match.size < 5 || match[4].empty? || match[4].nil?
129
- '0'
130
- end
131
-
132
- # Returns the browser name concatenated with the browser version. for example, 'ie7'.
133
- #
134
- # === Request
135
- # * +request+ - The request object.
136
- #
137
- def browser_full_name
138
- self.send( "browser_full_name_for_#{self.browser_name}".to_sym )
139
- end
140
-
141
- # Returns the browser name concatenated with the browser version. for example, 'ie7'.
142
- #
143
- # === Request
144
- # * +request+ - The request object.
145
- #
146
- def browser_id
147
- browser_name + browser_version.gsub( /\./, '' )
148
- end
149
-
150
- # Returns true if the current browser type can handle PNGs.
151
- #
152
- def can_use_png?
153
- return browser_version.to_i >= 7 if browser_name== 'ie'
154
- true
155
- end
156
-
157
- # A list of all the browser types that Guilded recognizes.
158
- #
159
- def self.all_browsers
160
- %w( chrome firefox ie55 ie60 ie70 ie80 konqueror netscape opera safari )
161
- end
162
-
163
- # A list of all the mobile browser types that Guilded recognizes.
164
- #
165
- def self.all_mobile_browsers
166
- %w( ie_ce4 iphone )
167
- end
168
-
169
- def self.user_agents
170
- {
171
- :ie55 => 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)',
172
- :ie60 => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)',
173
- :ie70 => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)',
174
- :ie80 => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)',
175
- :firefox2 => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17',
176
- :firefox3 => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.0.11) Gecko/2009060214 Firefox/3.0.11',
177
- :firefox35 => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3',
178
- :firefox35win => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)',
179
- :opera10 => 'Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00'
180
- }
181
- end
182
-
183
- protected
184
-
185
- def resolve_version_for_ie
186
- match = /.*msie (.*); windows nt 5.1/.match( @ua )
187
- return match.nil? ? '0' : match[1]
188
- end
189
-
190
- def resolve_version_for_firefox
191
- match = /.*\((.*); u;.*firefox\/(.*) \(.net.*/.match( @ua )
192
- if match.nil?
193
- match = /.*\((.*); u;.*firefox\/(.*)/.match( @ua )
194
- return match.nil? ? '0' : match[2]
195
- end
196
- return match.nil? ? '0' : match[2]
197
- end
198
-
199
- def resolve_version_for_opera
200
- match = /.*\((.*); intel.*version\/(.*)/.match( @ua )
201
- return match.nil? ? '0' : match[2]
202
- end
203
-
204
- def browser_full_name_for_ie
205
- "Internet Explorer #{browser_version}"
206
- end
207
-
208
- def browser_full_name_for_firefox
209
- "Firefox #{browser_version}"
210
- end
211
-
212
- def browser_full_name_for_opera
213
- "Opera #{browser_version}"
214
- end
215
-
216
- end
217
- end