Class: PuzzlyApiPlugin::TablesCollection

Inherits:
Collection show all
Includes:
Singleton
Defined in:
lib/puzzly_api_plugin/collection/tables.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/tables.rb', line 7

def add(document)
  table = Table.create(document)
   table
end

#get_by_module(mod) ⇒ Object



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

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

#get_by_modules(modules) ⇒ Object



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

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