Module: BrowserDetector::Rails::ViewHelpers

Defined in:
lib/browser_detector/rails/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#g_browser_full_nameObject

Returns the full browser name. For example, ‘Internet Explorer 7.0’.



52
53
54
55
# File 'lib/browser_detector/rails/view_helpers.rb', line 52

def g_browser_full_name
  setup_detector
  @g_browser_detector.browser_full_name
end

#g_browser_idObject

Returns the browser name concatenated with the browser version. for example, ‘ie7’. When using the browser detector in the contoller you may put a :g_browser_detector variabe in the session if you wish to keep the BrowserDetector from being instantiated more than once per request.



61
62
63
64
# File 'lib/browser_detector/rails/view_helpers.rb', line 61

def g_browser_id
  setup_detector
  @g_browser_detector.browser_id
end

#g_browser_is?(options = {}) ⇒ Boolean

Returns true if the browser matches the options ent in, otherwise returns false. When using the browser detector in the contoller you may put a :g_browser_detector variable in the session if you wish to keep the Detector from being instantiated more than once per request.

Options

  • :name - The name of the browser. For example ‘ie’.

  • :version - The version of the browser. For example ‘7’.

Returns:

  • (Boolean)


74
75
76
77
# File 'lib/browser_detector/rails/view_helpers.rb', line 74

def g_browser_is?( options={} )
  setup_detector
  @g_browser_detector.browser_is?( options )
end

#g_browser_nameObject

Returns the name of the browser that is making this request. For example ‘ie’. When using the browser detector in the contoller you may put a :g_browser_detector variabe in the session if you wish to keep the BrowserDetector from being instantiated more than once per request.



9
10
11
12
# File 'lib/browser_detector/rails/view_helpers.rb', line 9

def g_browser_name
  setup_detector
  @g_browser_detector.browser_name
end

#g_browser_versionObject

Returns the version of the browser that is making this request. For example ‘7’. When using the browser detector in the contoller you may put a :g_browser_detector variabe in the session if you wish to keep the BrowserDetector from being instantiated more than once per request.



18
19
20
21
# File 'lib/browser_detector/rails/view_helpers.rb', line 18

def g_browser_version
  setup_detector
  @g_browser_detector.browser_version
end

#g_browser_version_buildObject

Returns the major version of the browser that is making this request. For example ‘7’. When using the browser detector in the contoller you may put a :g_browser_detector variabe in the session if you wish to keep the BrowserDetector from being instantiated more than once per request.



45
46
47
48
# File 'lib/browser_detector/rails/view_helpers.rb', line 45

def g_browser_version_build
  setup_detector
  @g_browser_detector.browser_version_build
end

#g_browser_version_majorObject

Returns the major version of the browser that is making this request. For example ‘7’. When using the browser detector in the contoller you may put a :g_browser_detector variabe in the session if you wish to keep the BrowserDetector from being instantiated more than once per request.



27
28
29
30
# File 'lib/browser_detector/rails/view_helpers.rb', line 27

def g_browser_version_major
  setup_detector
  @g_browser_detector.browser_version_major
end

#g_browser_version_minorObject

Returns the major version of the browser that is making this request. For example ‘7’. When using the browser detector in the contoller you may put a :g_browser_detector variabe in the session if you wish to keep the BrowserDetector from being instantiated more than once per request.



36
37
38
39
# File 'lib/browser_detector/rails/view_helpers.rb', line 36

def g_browser_version_minor
  setup_detector
  @g_browser_detector.browser_version_minor
end