Class: LanGrove::Behaviour::Persistable
- Inherits:
-
LanGrove::Base
- Object
- LanGrove::Base
- LanGrove::Behaviour::Persistable
- Defined in:
- lib/langrove/behaviour/persistable.rb
Instance Attribute Summary
Attributes inherited from LanGrove::Base
Instance Method Summary collapse
-
#initialize(root, config, name) ⇒ Persistable
constructor
A new instance of Persistable.
Methods inherited from LanGrove::Base
Constructor Details
#initialize(root, config, name) ⇒ Persistable
Returns a new instance of Persistable.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/langrove/behaviour/persistable.rb', line 9 def initialize( root, config, name ) @requires = { # # Persistable requires a Persistor plugin. # :persistor => { # # IMPORTANT: # # Both store() and fetch() should use gen_key() # to assemble the storage key. # # It populates handler.key # # Which is expected by other behaviours. # :actions => [ # # Plugin should implement: # # result = <Plugin>.store( handler ) # # - Should persist the handler.capsule attribute. # # - (on success) Should return true. # - (on failed) Should return false. # :store, # # Plugin should implement: # # result = <Plugin>.gen_key( handler ) # # - Should use the :key: subconfig to assemble # the key from the handler.pending_capsule # and place the key in handler.key # # - Success assumed. # # - (on failure) Should THROW # :gen_key, # # Plugin should implement: # # result = <Plugin>.fetch( handler, key ) # # - Should fetch the handler.capsule attribute # # - (on success) Should return true. # - (on failed) Should return false # :fetch ], :version => PERSISTABLE_VERSION } } if @requires.nil? super end |