Module: MemMappr

Defined in:
lib/mem_mappr.rb,
lib/mem_mappr/config.rb

Defined Under Namespace

Modules: Config

Constant Summary collapse

@@config =
{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/mem_mappr.rb', line 8

def config
  @config
end

Class Method Details

.map(name, object) ⇒ Object



16
17
18
# File 'lib/mem_mappr.rb', line 16

def map(name, object)
   CACHE.set name, srlz(object)
end

.map_array(name, objects) ⇒ Object



29
30
31
# File 'lib/mem_mappr.rb', line 29

def map_array(name, objects)
   CACHE.set name, objects.map{|obj| srlz(obj)}
end

.setupObject



12
13
14
# File 'lib/mem_mappr.rb', line 12

def setup
   @@config = Config.setup
end

.unmap(name) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/mem_mappr.rb', line 20

def unmap(name)
   data = CACHE.get name
   object = nil
   unless data.empty?
      object = de_srlz(data)
   end
   object
end

.unmap_array(name) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mem_mappr.rb', line 33

def unmap_array(name)
   data = CACHE.get name
   object_array = []
   unless data.empty?
      data.each do |object|
         object_array << de_srlz(object)
      end
   end
   
   object_array
end