Class: PuzzlyApiPlugin::Cache
- Defined in:
- lib/puzzly_api_plugin/metadata/cache.rb
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(document, module_id, name, description, schema_file, schema_id) ⇒ Cache
constructor
A new instance of Cache.
- #module_id ⇒ Object
- #schema_file ⇒ Object
- #schema_id ⇒ Object
- #validate ⇒ Object
Methods inherited from Metadata
#id, #name, #path, #to_identity
Methods inherited from JSONable
Constructor Details
#initialize(document, module_id, name, description, schema_file, schema_id) ⇒ Cache
Returns a new instance of Cache.
14 15 16 17 18 19 20 21 22 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 14 def initialize(document, module_id, name, description, schema_file, schema_id) super(document, name) self[MetadataFields::MODULE_ID] = module_id self[MetadataFields::DESCRIPTION] = description self[MetadataFields::SCHEMA_FILE] = schema_file self[MetadataFields::SCHEMA_ID] = schema_id validate end |
Class Method Details
.create(document) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 5 def self.create(document) Cache.new(document, document.data[YAMLFields::MODULE_ID], document.data[YAMLFields::CACHE_NAME], document.data[YAMLFields::CACHE_DESCRIPTION], document.data[YAMLFields::CACHE_SCHEMA_FILE], document.data[YAMLFields::SCHEMA_ID]) end |
Instance Method Details
#description ⇒ Object
50 51 52 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 50 def description self[MetadataFields::DESCRIPTION] end |
#module_id ⇒ Object
46 47 48 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 46 def module_id self[MetadataFields::MODULE_ID] end |
#schema_file ⇒ Object
54 55 56 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 54 def schema_file self[MetadataFields::SCHEMA_FILE] end |
#schema_id ⇒ Object
58 59 60 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 58 def schema_id self[MetadataFields::SCHEMA_ID] end |
#validate ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/puzzly_api_plugin/metadata/cache.rb', line 24 def validate if(module_id.nil?) warn "Please set #{YAMLFields::MODULE_ID} property" end if(name.nil?) warn "Please set #{YAMLFields::CACHE_NAME} property" end if(description.nil?) warn "Please set #{YAMLFields::CACHE_DESCRIPTION} property" end if(schema_file.nil? && schema_id.nil?) warn "Please set #{YAMLFields::CACHE_SCHEMA_FILE} or #{YAMLFields::SCHEMA_ID} property" end if(!schema_file.nil? && !schema_id.nil?) warn "Please set only one between #{YAMLFields::CACHE_SCHEMA_FILE} and #{YAMLFields::SCHEMA_ID} properties" end end |