Sha256: 0358e70bcd723b6109edd10d19881cc25af589c666c4416109eb23508f4dde1b

Contents?: true

Size: 930 Bytes

Versions: 7

Compression:

Stored size: 930 Bytes

Contents

class Browser
  module Consoles
    # Detect if browser is running under Xbox.
    def xbox?
      !!(ua =~ /xbox/i)
    end

    # Detect if browser is running under Xbox One.
    def xbox_one?
      !!(ua =~ /xbox one/i)
    end

    # Detect if browser is running under PlayStation.
    def playstation?
      !!(ua =~ /playstation/i)
    end

    # Detect if browser is running under PlayStation 4.
    def playstation4?
      !!(ua =~ /playstation 4/i)
    end

    # Detect if browser is Nintendo.
    def nintendo?
      !!(ua =~ /nintendo/i)
    end

    # Detect if browser is console (currently Xbox, PlayStation, or Nintendo).
    def console?
      xbox? || playstation? || nintendo?
    end

    # Detect if browser is running from PSP.
    def psp?
      !!(ua =~ /(PSP)/ || psp_vita?)
    end

    # Detect if browser is running from PSP Vita.
    def psp_vita?
      !!(ua =~ /Playstation Vita/)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
browser-1.1.0 lib/browser/methods/consoles.rb
browser2-1.0.0 lib/browser/methods/consoles.rb
browser-1.0.1 lib/browser/methods/consoles.rb
browser-1.0.0 lib/browser/methods/consoles.rb
browser-0.9.1 lib/browser/methods/consoles.rb
browser-0.9.0 lib/browser/methods/consoles.rb
browser-0.8.0 lib/browser/methods/consoles.rb