Module: Browser
- Defined in:
- lib/source/redshift/browser.rb
Overview
The Browser
module contains methods for checking the current platform and rendering engine.
Defined Under Namespace
Constant Summary collapse
- Plugins =
{}
Class Method Summary collapse
-
.engine ⇒ Object
call-seq: Browser.engine -> hash.
-
.platform ⇒ Object
call-seq: Browser.platform -> string.
Class Method Details
.engine ⇒ Object
call-seq:
Browser.engine -> hash
Returns a hash containing the name and version of the current rendering engine.
Browser.engine #=> {:name => "gecko", :version => 19}
15 16 17 |
# File 'lib/source/redshift/browser.rb', line 15 def self.engine {:name => Engine.instance_variable_get('@name'), :version => Engine.instance_variable_get('@version')} end |
.platform ⇒ Object
call-seq:
Browser.platform -> string
Returns the name of the current platform as a string.
Browser.platform #=> "mac"
26 27 28 |
# File 'lib/source/redshift/browser.rb', line 26 def self.platform @platform ||= `$q(window.orientation==undefined?(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase():'ipod')` end |