Sha256: 8216cfe256062278238b69a29ee5d8cc677d23e5eef526025be4970ed48eddc0

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 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')
           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

3 entries across 3 versions & 1 rubygems

Version Path
woothee-0.2.4 lib/woothee/appliance.rb
woothee-0.2.1 lib/woothee/appliance.rb
woothee-0.2.0 lib/woothee/appliance.rb