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
- #each ⇒ Object
- #empty? ⇒ Boolean
- #fetch(key) ⇒ Object
- #key?(key) ⇒ Boolean (also: #member?, #has_key?)
Instance Method Details
#each ⇒ Object
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
38 39 40 |
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 38 def empty? to_a.empty? end |
#fetch(key) ⇒ Object
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?
26 27 28 |
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 26 def key?(key) keys.include? key end |