module Mumukit::Sync
An import and export pipeline for generic resources.
A resource - that is, something that can be imported or exported - must implement the following methods:
-
sync_key: returns a kind-id pair created using `Mumukit::Sync.key`, used to locate resources within a store
-
to_resource_h: returns a canonical hash representation of the resource. Only required by `Mumukit::Sync#export!`
-
import_from_resource_h!: populates and saves the resource with its canonical hash representation
-
.locate_resource(resource_id): finds or initializes the resource given its resource id. Only required by `Mumukit::Sync#import_all!`
Constants
- VERSION
Public Class Methods
depracated
# File lib/mumukit/sync.rb, line 26 def self.classify(kind) kind.as_module_name end
depracated
# File lib/mumukit/sync.rb, line 21 def self.constantize(kind) kind.as_module end
Creates a sync key, composed of a `kind` and `id`
kind: string|symbol|class id: object
Warning: in order to test the `kind`, always use the `like?` message
# File lib/mumukit/sync.rb, line 16 def self.key(kind, id) struct kind: kind, id: id end