Class: UserAgent::Browsers::Vivaldi

Inherits:
Base
  • Object
show all
Defined in:
lib/user_agent/browsers/vivaldi.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#<=>, #bot?, #eql?, #method_missing, #mobile?, #respond_to?, #to_h, #to_s, #to_str

Methods included from Comparable

#<, #<=, #==, #>, #>=

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class UserAgent::Browsers::Base

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)

4
5
6
# File 'lib/user_agent/browsers/vivaldi.rb', line 4

def self.extend?(agent)
  agent.detect { |useragent| useragent.product == 'Vivaldi' }
end

Instance Method Details

#applicationObject


20
21
22
# File 'lib/user_agent/browsers/vivaldi.rb', line 20

def application
  self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first
end

#browserObject


8
9
10
# File 'lib/user_agent/browsers/vivaldi.rb', line 8

def browser
  'Vivaldi'
end

#buildObject


12
13
14
# File 'lib/user_agent/browsers/vivaldi.rb', line 12

def build
  webkit.version
end

#localizationObject


56
57
58
59
60
# File 'lib/user_agent/browsers/vivaldi.rb', line 56

def localization
  return unless application

  application.comment[3]
end

#osObject


42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/user_agent/browsers/vivaldi.rb', line 42

def os
  return unless application

  if application.comment[0] =~ /Windows NT/
    OperatingSystems.normalize_os(application.comment[0])
  elsif application.comment[2].nil?
    OperatingSystems.normalize_os(application.comment[1])
  elsif application.comment[1] =~ /Android/
    OperatingSystems.normalize_os(application.comment[1])
  else
    OperatingSystems.normalize_os(application.comment[2])
  end
end

#platformObject


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/user_agent/browsers/vivaldi.rb', line 24

def platform
  return unless application

  if application.comment[0] =~ /Windows/
    'Windows'
  elsif application.comment.any? { |c| c =~ /CrOS/ }
    'ChromeOS'
  elsif application.comment.any? { |c| c =~ /Android/ }
    'Android'
  else
    application.comment[0]
  end
end

#versionObject


16
17
18
# File 'lib/user_agent/browsers/vivaldi.rb', line 16

def version
  last.version
end

#webkitObject


38
39
40
# File 'lib/user_agent/browsers/vivaldi.rb', line 38

def webkit
  detect_product("AppleWebKit")
end