Method: Kimurai::Base::Storage#add

Defined in:
lib/kimurai/base/storage.rb

#add(scope, value) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kimurai/base/storage.rb', line 24

def add(scope, value)
  @mutex.synchronize do
    database[scope] ||= []
    if value.kind_of?(Array)
      database[scope] += value
      database[scope].uniq!
    else
      database[scope].push(value) unless database[scope].include?(value)
    end
  end
end