Class: PuzzlyApiPlugin::TableView

Inherits:
Renderable show all
Defined in:
lib/puzzly_api_plugin/view/table.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Renderable

#apis, #caches, #contexts, #modules, #path, #queries, #render, #schemas, #tables, #topics

Methods inherited from JSONable

#copy_to_hash, #to_s

Constructor Details

#initialize(mod, table) ⇒ TableView

Returns a new instance of TableView.



12
13
14
15
16
17
# File 'lib/puzzly_api_plugin/view/table.rb', line 12

def initialize(mod, table)
  table.copy_to_hash self
  self.delete MetadataFields::MODULE_ID
        
  self[MetadataFields::MODULE] = mod
end

Class Method Details

.create(table) ⇒ Object



5
6
7
8
9
10
# File 'lib/puzzly_api_plugin/view/table.rb', line 5

def self.create(table)
  mod = ModulesCollection.instance.get_by_id table.module_id

  TableView.new(mod.to_identity, 
              table)
end