Class: DeviceWizard::FirefoxResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/device_wizard.rb

Constant Summary collapse

KEYWORD =
'firefox'
REGEX =
Regexp.new('firefox/([0-9]+.[0-9])')

Instance Method Summary collapse

Instance Method Details

#get_version(user_agent) ⇒ Object



160
161
162
163
164
165
166
167
# File 'lib/device_wizard.rb', line 160

def get_version(user_agent)
  user_agent.downcase!
  result = UNKNOWN

  if REGEX =~ user_agent
    result = $1
  end
end

#identify(user_agent) ⇒ Object



169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/device_wizard.rb', line 169

def identify(user_agent)
  user_agent.downcase!

  if !user_agent.include? KEYWORD
    return nil
  end

  result = BrowserDetails.new
  result.name = 'Firefox'
  result.version = get_version(user_agent)
  return result
end