123456789_123456789_123456789_123456789_123456789_

Module: Selenium::WebDriver::ProfileHelper Private

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: rb/lib/selenium/webdriver/common/profile_helper.rb

Overview

Common methods for Chrome::Profile and Firefox::Profile Includers must implement #layout_on_disk

Class Method Summary

Instance Method Summary

Class Method Details

.decoded(json)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 34

def self.decoded(json)
  JSON.parse(json).fetch('zip')
end

.included(base)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 30

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#as_json

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 42

def as_json(*)
  {'zip' => encoded}
end

#create_tmp_copy(directory) (private)

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 52

def create_tmp_copy(directory)
  tmp_directory = Dir.mktmpdir('webdriver-rb-profilecopy')

  # TODO: must be a better way..
  FileUtils.rm_rf tmp_directory
  FileUtils.mkdir_p File.dirname(tmp_directory), mode: 0o700
  FileUtils.cp_r directory, tmp_directory

  tmp_directory
end

#encoded

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 38

def encoded
  Zipper.zip(layout_on_disk)
end

#to_json

[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 46

def to_json(*)
  JSON.generate as_json
end

#verify_model(model) (private)

Raises:

  • (Errno::ENOENT)
[ GitHub ]

  
# File 'rb/lib/selenium/webdriver/common/profile_helper.rb', line 63

def verify_model(model)
  return unless model

  raise Errno::ENOENT, model unless File.exist?(model)
  raise Errno::ENOTDIR, model unless File.directory?(model)

  model
end