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

#each(&blk) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 50

def each(&blk)
  return enum_for(:each) unless block_given?

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

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  size == 0
end

#fetch(key, &blk) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 33

def fetch(key, &blk)
  if self.key? key
    return self[key]
  end

  if block_given?
    yield key
  else
    # should be KeyError, but it's 1.9-specific
    raise IndexError, "missing key #{key.inspect}"
  end
end

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

Returns:

  • (Boolean)


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

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