Class: Lit::Adapters::HashStorage

Inherits:
Hash
  • Object
show all
Defined in:
lib/lit/adapters/hash_storage.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



16
17
18
# File 'lib/lit/adapters/hash_storage.rb', line 16

def [](key)
  super || subtree_of_key(key)
end

#incr(key) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/lit/adapters/hash_storage.rb', line 3

def incr(key)
  self[key] ||= 0
  if self[key].is_a?(Integer)
    self[key] += 1
  else
    subtree_keys(key).each { |k| self[k] += 1 }
  end
end

#prefixObject



12
13
14
# File 'lib/lit/adapters/hash_storage.rb', line 12

def prefix
  nil
end