Class: Warp::Dir::Serializer::Base
- Defined in:
- lib/warp/dir/serializer/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#store ⇒ Object
Returns the value of attribute store.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(store) ⇒ Base
constructor
A new instance of Base.
-
#persist! ⇒ Object
save shortcuts to the persistence layer.
-
#restore! ⇒ Object
restore method should read the values from somewhere (i.e. database?) and perform the following operation:.
Constructor Details
#initialize(store) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/warp/dir/serializer/base.rb', line 7 def initialize store self.store = store end |
Instance Attribute Details
#store ⇒ Object
Returns the value of attribute store.
5 6 7 |
# File 'lib/warp/dir/serializer/base.rb', line 5 def store @store end |
Class Method Details
.inherited(subclass) ⇒ Object
15 16 17 |
# File 'lib/warp/dir/serializer/base.rb', line 15 def self.inherited subclass Warp::Dir::SERIALIZERS[subclass.name] = subclass end |
Instance Method Details
#config ⇒ Object
11 12 13 |
# File 'lib/warp/dir/serializer/base.rb', line 11 def config self.store.config end |
#persist! ⇒ Object
save shortcuts to the persistence layer
store.points.each_pair |shortcut, path| do
save(shortcut, path)
end
37 38 39 |
# File 'lib/warp/dir/serializer/base.rb', line 37 def persist! raise NotImplementedError.new('Abstract Method') end |
#restore! ⇒ Object
restore method should read the values from somewhere (i.e. database?) and perform the following operation:
for each [ shortcut, path ] do
self.store.add(shortcut, path)
end
27 28 29 |
# File 'lib/warp/dir/serializer/base.rb', line 27 def restore! raise NotImplementedError.new('Abstract Method') end |