Module: Selenium::WebDriver::HTML5::SharedWebStorage

Includes:
Enumerable
Included in:
LocalStorage, SessionStorage
Defined in:
lib/selenium/webdriver/common/html5/shared_web_storage.rb

Instance Method Summary collapse

Instance Method Details

#eachObject



42
43
44
45
46
47
48
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 42

def each
  return enum_for(:each) unless block_given?

  keys.each do |k|
    yield k, self[k]
  end
end

#empty?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 38

def empty?
  to_a.empty?
end

#fetch(key) ⇒ Object

Raises:

  • (KeyError)


32
33
34
35
36
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 32

def fetch(key)
  return self[key] if key? key
  return yield(key) if block_given?
  raise KeyError, "missing key #{key.inspect}"
end

#key?(key) ⇒ Boolean Also known as: member?, has_key?

Returns:

  • (Boolean)


26
27
28
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 26

def key?(key)
  keys.include? key
end