Sha256: 2d3d317e5d9acb838883e7f4398a1e7d2285e6f7bc5bf73a232be2dcb48d32ee

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

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

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

module Woothee::Appliance
  extend Woothee::Util

  def self.challenge_playstation(ua, result)
    data = case
           when ua.index('PSP (PlayStation Portable);') then Woothee::DataSet.get('PSP')
           when ua.index('PlayStation Vita') then Woothee::DataSet.get('PSVita')
           when ua.index('PLAYSTATION 3;') then Woothee::DataSet.get('PS3')
           else nil
           end
    return false unless data

    update_map(result, data)
    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

1 entries across 1 versions & 1 rubygems

Version Path
woothee-0.3.0 lib/woothee/appliance.rb