Module: Browser::Consoles

Included in:
Browser
Defined in:
lib/browser/methods/consoles.rb

Instance Method Summary collapse

Instance Method Details

#console?Boolean

Detect if browser is console (currently Xbox, PlayStation, or Nintendo).

Returns:

  • (Boolean)


29
30
31
# File 'lib/browser/methods/consoles.rb', line 29

def console?
  xbox? || playstation? || nintendo?
end

#nintendo?Boolean

Detect if browser is Nintendo.

Returns:

  • (Boolean)


24
25
26
# File 'lib/browser/methods/consoles.rb', line 24

def nintendo?
  !!(ua =~ /nintendo/i)
end

#playstation4?Boolean

Detect if browser is running under PlayStation 4.

Returns:

  • (Boolean)


19
20
21
# File 'lib/browser/methods/consoles.rb', line 19

def playstation4?
  !!(ua =~ /playstation 4/i)
end

#playstation?Boolean

Detect if browser is running under PlayStation.

Returns:

  • (Boolean)


14
15
16
# File 'lib/browser/methods/consoles.rb', line 14

def playstation?
  !!(ua =~ /playstation/i)
end

#psp?Boolean

Detect if browser is running from PSP.

Returns:

  • (Boolean)


34
35
36
# File 'lib/browser/methods/consoles.rb', line 34

def psp?
  !!(ua =~ /(PSP)/ || psp_vita?)
end

#psp_vita?Boolean

Detect if browser is running from PSP Vita.

Returns:

  • (Boolean)


39
40
41
# File 'lib/browser/methods/consoles.rb', line 39

def psp_vita?
  !!(ua =~ /Playstation Vita/)
end

#xbox?Boolean

Detect if browser is running under Xbox.

Returns:

  • (Boolean)


4
5
6
# File 'lib/browser/methods/consoles.rb', line 4

def xbox?
  !!(ua =~ /xbox/i)
end

#xbox_one?Boolean

Detect if browser is running under Xbox One.

Returns:

  • (Boolean)


9
10
11
# File 'lib/browser/methods/consoles.rb', line 9

def xbox_one?
  !!(ua =~ /xbox one/i)
end