midas-guilded 0.2.5 → 0.2.6

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{guilded}
5
- s.version = "0.2.5"
5
+ s.version = "0.2.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["C. Jason Harrelson (midas)"]
@@ -73,7 +73,7 @@ require 'guilded/rails/inactive_record/human_attribute_hint'
73
73
  # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %>
74
74
  #
75
75
  module Guilded
76
- VERSION = '0.2.5'
76
+ VERSION = '0.2.6'
77
77
  end
78
78
 
79
79
  ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -1,6 +1,19 @@
1
1
  module Guilded
2
+
3
+ # The BrowserDetector provides the ability to determine browser information from the user
4
+ # agent string.
5
+ #
2
6
  class BrowserDetector
3
7
 
8
+ # Returns true if the browser matches the options ent in, otherwise returns false.
9
+ #
10
+ # === Request
11
+ # * +request+ - The request object.
12
+ #
13
+ # === Options
14
+ # * +:name+ - The name of the browser. For example 'ie'.
15
+ # * +:version+ - The version of the browser. For example '7'.
16
+ #
4
17
  def self.browser_is?( request, options={} )
5
18
  #name = name.to_s.strip
6
19
  name = options[:name].to_s.strip
@@ -12,6 +25,11 @@ module Guilded
12
25
  return true if name == 'webkit' && browser_name( request ) == 'safari'
13
26
  end
14
27
 
28
+ # Returns the name of the browser that is making this request. For example 'ie'.
29
+ #
30
+ # === Request
31
+ # * +request+ - The request object.
32
+ #
15
33
  def self.browser_name( request )
16
34
  @browser_name ||= begin
17
35
  ua = request.env['HTTP_USER_AGENT']
@@ -46,7 +64,21 @@ module Guilded
46
64
  end
47
65
  end
48
66
  end
67
+
68
+ # Returns the browser name concatenated with the browser version. for example, 'ie7'.
69
+ #
70
+ # === Request
71
+ # * +request+ - The request object.
72
+ #
73
+ def self.browser_full_name( request )
74
+ browser_name( request ) + browser_version( request )
75
+ end
49
76
 
77
+ # Returns the version of the browser that is making this request. For example '7'.
78
+ #
79
+ # === Request
80
+ # * +request+ - The request object.
81
+ #
50
82
  def self.browser_version( request )
51
83
  @browser_version ||= begin
52
84
  ua = request.env['HTTP_USER_AGENT'].downcase
@@ -81,16 +113,12 @@ module Guilded
81
113
  end
82
114
 
83
115
  def self.all_browsers
84
- [ 'ie7', 'ie6', 'opera', 'firefox', 'netscape', 'konqueror', 'safari' ]
116
+ %W( ie7, ie6, opera, firefox, netscape, konqueror, safari )
85
117
  end
86
118
 
87
119
  def self.all_mobile_browsers
88
120
  %w( ie4_ce )
89
121
  end
90
122
 
91
- def self.all_formats
92
- %w( html, xml, mobile )
93
- end
94
-
95
123
  end
96
124
  end
@@ -83,16 +83,30 @@ module Guilded
83
83
  end
84
84
  end
85
85
 
86
- # returns the name of the browser that is making this request.
86
+ # Returns the name of the browser that is making this request. For example 'ie'.
87
87
  #
88
88
  def g_browser_name
89
89
  Guilded::BrowserDetector.browser_name( request )
90
90
  end
91
91
 
92
+ # Returns the version of the browser that is making this request. For example '7'.
93
+ #
92
94
  def g_browser_version
93
95
  Guilded::BrowserDetector.browser_version( request )
94
96
  end
95
97
 
98
+ # Returns the browser name concatenated with the browser version. for example, 'ie7'.
99
+ #
100
+ def g_browser_full_name
101
+ Guilded::BrowserDetector.browser_full_name( request )
102
+ end
103
+
104
+ # Returns true if the browser matches the options ent in, otherwise returns false.
105
+ #
106
+ # === Options
107
+ # * +:name+ - The name of the browser. For example 'ie'.
108
+ # * +:version+ - The version of the browser. For example '7'.
109
+ #
96
110
  def g_browser_is?( options={} )
97
111
  Guilded::BrowserDetector.browser_is?( request, options )
98
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midas-guilded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas)