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).



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

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

#nintendo?Boolean

Detect if browser is Nintendo.



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.



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.



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.



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.



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.



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.



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

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