Sha256: 2fdb2b324df565a2c0157ff296583dbf569f1b845dc3f348ed80261ce3a15df5

Contents?: true

Size: 1.77 KB

Versions: 15

Compression:

Stored size: 1.77 KB

Contents

# -*- coding: utf-8 -*-

require 'woothee/dataset'
require 'woothee/util'

module Woothee::Appliance
  extend Woothee::Util

  def self.challenge_playstation(ua, result)
    data = nil
    os_version = nil
    case
    when ua.index('PSP (PlayStation Portable);')
      data = Woothee::DataSet.get('PSP')
      if ua =~ /PSP \(PlayStation Portable\); ([.0-9]+)\)/
        os_version = $1
      end
    when ua.index('PlayStation Vita')
      data = Woothee::DataSet.get('PSVita')
      if ua =~ /PlayStation Vita ([.0-9]+)\)/
        os_version = $1
      end
    when ua.index('PLAYSTATION 3 ') || ua.index('PLAYSTATION 3;')
      data = Woothee::DataSet.get('PS3')
      if ua =~ /PLAYSTATION 3;? ([.0-9]+)\)/
        os_version = $1
      end
    when ua.index('PlayStation 4 ')
      data = Woothee::DataSet.get('PS4')
      if ua =~ /PlayStation 4 ([.0-9]+)\)/
        os_version = $1
      end
    end
    return false unless data

    update_map(result, data)
    if os_version
      update_os_version(result, os_version)
    end
    true
  end

  def self.challenge_nintendo(ua, result)
    data = case
           when ua.index('Nintendo 3DS;') then Woothee::DataSet.get('Nintendo3DS')
           when ua.index('Nintendo DSi;') then Woothee::DataSet.get('NintendoDSi')
           when ua.index('Nintendo Wii;') then Woothee::DataSet.get('NintendoWii')
           when ua.index('(Nintendo WiiU)') then Woothee::DataSet.get('NintendoWiiU')
           else nil
           end
    return false unless data

    update_map(result, data)
    true
  end

  def self.challenge_digitaltv(ua, result)
    data = if ua.index('InettvBrowser/')
             Woothee::DataSet.get('DigitalTV')
           else
             nil
           end
    return false unless data

    update_map(result, data)
    true
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
woothee-1.13.0 lib/woothee/appliance.rb
woothee-1.11.1 lib/woothee/appliance.rb
woothee-1.11.0 lib/woothee/appliance.rb
woothee-1.10.0 lib/woothee/appliance.rb
woothee-1.9.0 lib/woothee/appliance.rb
woothee-1.8.0 lib/woothee/appliance.rb
woothee-1.7.0 lib/woothee/appliance.rb
woothee-1.5.0 lib/woothee/appliance.rb
woothee-1.4.0 lib/woothee/appliance.rb
woothee-1.3.0 lib/woothee/appliance.rb
woothee-1.2.0 lib/woothee/appliance.rb
woothee-1.1.1 lib/woothee/appliance.rb
woothee-1.1.0 lib/woothee/appliance.rb
woothee-1.0.1 lib/woothee/appliance.rb
woothee-1.0.0 lib/woothee/appliance.rb