Class: Three::Browser::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/three/browser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#handleObject (readonly)

Returns the value of attribute handle.



56
57
58
# File 'lib/three/browser.rb', line 56

def handle
  @handle
end

Instance Method Details

#clearObject



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

#lengthObject



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