Module: Mumukit::Sync
- Defined in:
- lib/mumukit/sync/syncer.rb,
lib/mumukit/sync.rb,
lib/mumukit/sync/store.rb,
lib/mumukit/sync/version.rb,
lib/mumukit/sync/inflator.rb
Overview
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!`
Defined Under Namespace
Modules: Inflator, Store Classes: Syncer
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
- .classify(kind) ⇒ Object
- .constantize(kind) ⇒ Object
-
.key(kind, id) ⇒ Object
Creates a sync key, composed of a ‘kind` and `id`.
Class Method Details
.classify(kind) ⇒ Object
18 19 20 |
# File 'lib/mumukit/sync.rb', line 18 def self.classify(kind) kind.to_s.classify end |
.constantize(kind) ⇒ Object
14 15 16 |
# File 'lib/mumukit/sync.rb', line 14 def self.constantize(kind) classify(kind).constantize end |
.key(kind, id) ⇒ Object
Creates a sync key, composed of a ‘kind` and `id`
10 11 12 |
# File 'lib/mumukit/sync.rb', line 10 def self.key(kind, id) struct kind: kind, id: id end |