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)


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

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

#nintendo?Boolean

Detect if browser is Nintendo.

Returns:

  • (Boolean)


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

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

#playstation?Boolean

Detect if browser is PlayStation.

Returns:

  • (Boolean)


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

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

#psp?Boolean

Detect if browser is running from PSP.

Returns:

  • (Boolean)


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

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

#xbox?Boolean

Detect if browser is Xbox.

Returns:

  • (Boolean)


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

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