Class: Three::Browser::Storage
- Inherits:
-
Object
- Object
- Three::Browser::Storage
- Defined in:
- lib/three/browser.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
- #clear ⇒ Object
- #delete(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(handle) ⇒ Storage
constructor
A new instance of Storage.
- #key(index) ⇒ Object
- #length ⇒ Object
- #set(key, value) ⇒ Object
Constructor Details
#initialize(handle) ⇒ Storage
Returns a new instance of Storage.
58 59 60 |
# File 'lib/three/browser.rb', line 58 def initialize(handle) @handle = handle end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
56 57 58 |
# File 'lib/three/browser.rb', line 56 def handle @handle end |
Instance Method Details
#clear ⇒ Object
76 77 78 79 |
# File 'lib/three/browser.rb', line 76 def clear @handle.call(:clear) self end |
#delete(key) ⇒ Object
71 72 73 74 |
# File 'lib/three/browser.rb', line 71 def delete(key) @handle.call(:removeItem, key.to_s) self end |
#get(key) ⇒ Object
67 68 69 |
# File 'lib/three/browser.rb', line 67 def get(key) @handle.call(:getItem, key.to_s) end |
#key(index) ⇒ Object
85 86 87 |
# File 'lib/three/browser.rb', line 85 def key(index) @handle.call(:key, index) end |
#length ⇒ Object
81 82 83 |
# File 'lib/three/browser.rb', line 81 def length @handle[:length].to_i end |
#set(key, value) ⇒ Object
62 63 64 65 |
# File 'lib/three/browser.rb', line 62 def set(key, value) @handle.call(:setItem, key.to_s, value) self end |