Module: SpobBrowserDetector::Rails::ViewHelpers

Defined in:
lib/spob_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’.



25
26
27
28
# File 'lib/spob_browser_detector/rails/view_helpers.rb', line 25

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.



34
35
36
37
# File 'lib/spob_browser_detector/rails/view_helpers.rb', line 34

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)


47
48
49
50
# File 'lib/spob_browser_detector/rails/view_helpers.rb', line 47

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/spob_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/spob_browser_detector/rails/view_helpers.rb', line 18

def g_browser_version
  setup_detector
  @g_browser_detector.browser_version
end