lib/bad_browser/user_agent.rb
# We need a special method just for Opera since it's user agent strings are a nightmare (see fixtures).
# Opera's user-agent include various tokens and strings that try to make it look like MSIE or Firefox
# Always set @opera as well since we know it is Opera at this point
We need a special method just for Opera since it's user agent strings are a nightmare .
Opera's user-agent include various tokens and strings that try to make it look like MSIE or Firefox
Always set @opera as well since we know it is Opera at this point
We need a special method just for Opera since it ' s user agent strings are a nightmare . Opera ' s user - agent include various tokens and strings that try to make it look like MSIE or Firefox Always set @opera as well since we know it is Opera at this point
def match_opera
    match = match_agent(/Version\/(\d{1,2}\.\d{1,2})/) || match_agent(/Opera[ \(\/]*(\d{1,2}\.\d{1,2}[u1]*)/)
    @browser = :opera
    if match
      version = match.last.split('.')
      version[1] = version[1].ljust(2, '0')
      @version = BrowserVersion.new version.join('.')
    end
  end
def match_opera match = match_agent ( / Version \/ ( \d {1,2} \. \d {1,2}) / ) || match_agent ( / Opera[  \( \/ ]*( \d {1,2} \. \d {1,2}[u1]*) / ) @browser = :opera if match version = match . last . split ( '.' ) version [ 1 ] = version [ 1 ] . ljust ( 2 , '0' ) @version = BrowserVersion . new version . join ( '.' ) end end
We need a special method just for Opera since it's user agent strings are a nightmare (see fixtures).
We need a special method just for Opera since it ' s user agent strings are a nightmare ( see fixtures ) .