File: aliases.rb

package info (click to toggle)
ruby-browser 5.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 872 kB
  • sloc: ruby: 4,752; makefile: 13
file content (32 lines) | stat: -rw-r--r-- 1,069 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

require_relative "../browser"
require "forwardable"

module Browser
  module Aliases
    PLATFORM_ALIASES = %w[
      adobe_air? android? blackberry? chrome_os? firefox_os? ios? ios_app?
      ios_webview? linux? mac? windows10? windows7? windows8? windows8_1?
      windows? windows_mobile? windows_phone? windows_rt?
      windows_touchscreen_desktop? windows_vista? windows_wow64? windows_x64?
      windows_x64_inclusive? windows_xp?
    ].freeze

    DEVICE_ALIASES = %w[
      blackberry_playbook? console? ipad? iphone? ipod_touch? kindle?
      kindle_fire? mobile? nintendo? nintendo_switch? nintendo_wii?
      nintendo_wiiu? playbook? playstation3? playstation4? playstation?
      playstation_vita? ps3? ps4? psp? psp_vita? silk? surface? tablet? tv?
      vita? wii? wiiu? xbox? xbox_360? xbox_one?
    ].freeze

    def self.included(target)
      target.class_eval do
        extend Forwardable
        def_delegators :platform, *PLATFORM_ALIASES
        def_delegators :device, *DEVICE_ALIASES
      end
    end
  end
end