Class: Warp::Dir::Serializer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/warp/dir/serializer/base.rb

Direct Known Subclasses

Dotfile

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#storeObject

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

#configObject



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

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/warp/dir/serializer/base.rb', line 27

def restore!
  raise NotImplementedError.new('Abstract Method')
end