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

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

Instance Method Summary collapse

Instance Method Details

#eachObject



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

def each
  return enum_for(:each) unless block_given?

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  to_a.empty?
end

#fetch(key) ⇒ Object

Raises:

  • (KeyError)


32
33
34
35
36
37
# File 'rb/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 'rb/lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 26

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