Class: PuzzlyApiPlugin::CacheView
- Inherits:
-
Renderable
- Object
- Hash
- JSONable
- Renderable
- PuzzlyApiPlugin::CacheView
- Defined in:
- lib/puzzly_api_plugin/view/cache.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(mod, schema, cache) ⇒ CacheView
constructor
A new instance of CacheView.
Methods inherited from Renderable
#apis, #caches, #contexts, #modules, #path, #queries, #render, #schemas, #tables, #topics
Methods inherited from JSONable
Constructor Details
#initialize(mod, schema, cache) ⇒ CacheView
Returns a new instance of CacheView.
21 22 23 24 25 26 27 28 |
# File 'lib/puzzly_api_plugin/view/cache.rb', line 21 def initialize(mod, schema, cache) cache.copy_to_hash self self.delete MetadataFields::MODULE_ID self.delete MetadataFields::SCHEMA_ID self[MetadataFields::MODULE] = mod self[MetadataFields::SCHEMA] = schema end |
Class Method Details
.create(cache) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/puzzly_api_plugin/view/cache.rb', line 5 def self.create(cache) mod = ModulesCollection.instance.get_by_id cache.module_id schema = nil if(!cache.schema_id.nil?) schema = SchemasCollection.instance.get_by_id cache.schema_id end if(!schema.nil?) schema = schema.to_identity end CacheView.new(mod.to_identity, schema, cache) end |