Class: Ferrum::Browser::Options::Base

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/ferrum/browser/options/base.rb

Direct Known Subclasses

Chrome, Firefox

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.optionsObject

[View source]

12
13
14
# File 'lib/ferrum/browser/options/base.rb', line 12

def self.options
  instance
end

.versionString?

Returns:

  • (String, nil)
[View source]

17
18
19
20
21
22
# File 'lib/ferrum/browser/options/base.rb', line 17

def self.version
  out, = Open3.capture2(instance.detect_path, "--version")
  out.strip
rescue Errno::ENOENT
  nil
end

Instance Method Details

#detect_pathObject

[View source]

32
33
34
# File 'lib/ferrum/browser/options/base.rb', line 32

def detect_path
  Binary.find(self.class::PLATFORM_PATH[Utils::Platform.name])
end

#except(*keys) ⇒ Object

[View source]

28
29
30
# File 'lib/ferrum/browser/options/base.rb', line 28

def except(*keys)
  to_h.reject { |n, _| keys.include?(n) }
end

#merge_default(flags, options) ⇒ Object

[View source]

40
41
42
# File 'lib/ferrum/browser/options/base.rb', line 40

def merge_default(flags, options)
  raise NotImplementedError
end

#merge_required(flags, options, user_data_dir) ⇒ Object

[View source]

36
37
38
# File 'lib/ferrum/browser/options/base.rb', line 36

def merge_required(flags, options, user_data_dir)
  raise NotImplementedError
end

#to_hObject

[View source]

24
25
26
# File 'lib/ferrum/browser/options/base.rb', line 24

def to_h
  self.class::DEFAULT_OPTIONS
end