Class: PuzzlyApiPlugin::CachesCollection

Inherits:
Collection show all
Includes:
Singleton
Defined in:
lib/puzzly_api_plugin/collection/caches.rb

Instance Method Summary collapse

Methods inherited from Collection

#add_metadata, #get_by_id, #identities

Methods inherited from JSONable

#copy_to_hash, #to_s

Instance Method Details

#add(document) ⇒ Object



7
8
9
10
# File 'lib/puzzly_api_plugin/collection/caches.rb', line 7

def add(document)
  cache = Cache.create(document)
   cache
end

#get_by_module(mod) ⇒ Object



16
17
18
# File 'lib/puzzly_api_plugin/collection/caches.rb', line 16

def get_by_module(mod)
  select { |_id, cache| mod.id == cache.module_id }
end

#get_by_modules(modules) ⇒ Object



12
13
14
# File 'lib/puzzly_api_plugin/collection/caches.rb', line 12

def get_by_modules(modules)
  select { |_id, cache| modules.key?(cache.module_id) }
end

#get_by_schema(schema) ⇒ Object



20
21
22
# File 'lib/puzzly_api_plugin/collection/caches.rb', line 20

def get_by_schema(schema)
  select { |_id, cache| schema.id == cache.schema_id }
end