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

Constant Summary collapse

BROWSER_HOST =
"127.0.0.1"
BROWSER_PORT =
"0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.optionsObject



14
15
16
# File 'lib/ferrum/browser/options/base.rb', line 14

def self.options
  instance
end

Instance Method Details

#detect_pathObject



26
27
28
29
30
31
32
33
34
# File 'lib/ferrum/browser/options/base.rb', line 26

def detect_path
  if Ferrum.mac?
    self.class::MAC_BIN_PATH.find { |n| File.exist?(n) }
  else
    self.class::LINUX_BIN_PATH.find do |name|
      path = Cliver.detect(name) and break(path)
    end
  end
end

#except(*keys) ⇒ Object



22
23
24
# File 'lib/ferrum/browser/options/base.rb', line 22

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

#merge_default(flags, options) ⇒ Object



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



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



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

def to_h
  self.class::DEFAULT_OPTIONS
end