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(&blk) ⇒ Object
- #empty? ⇒ Boolean
- #fetch(key, &blk) ⇒ Object
- #key?(key) ⇒ Boolean (also: #member?, #has_key?)
Instance Method Details
#each(&blk) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 31 def each(&blk) return enum_for(:each) unless block_given? keys.each do |k| yield k, self[k] end end |
#empty? ⇒ Boolean
27 28 29 |
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 27 def empty? size == 0 end |
#fetch(key, &blk) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 14 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?
8 9 10 |
# File 'lib/selenium/webdriver/common/html5/shared_web_storage.rb', line 8 def key?(key) keys.include? key end |