Class: MultiGit::Ref::Updater Abstract
- Inherits:
-
Object
- Object
- MultiGit::Ref::Updater
- Defined in:
- lib/multi_git/ref.rb
Overview
This class is abstract.
Updates a reference. Different subclasses use different mechanisms for locking and storing the references. Locks may be acquired in the constructor and must be released in #destroy! .
Updaters are inherently neither threadsafe nor reuseable. This should , however, not be a problem since they are not allocated by users.
Direct Known Subclasses
JGitBackend::Ref::Updater, FileUpdater, RecklessUpdater, MultiGit::RuggedBackend::Ref::Updater
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#destroy! ⇒ Object
Release all resources used by this updater.
-
#initialize(ref) ⇒ Updater
constructor
A new instance of Updater.
- #name ⇒ String
- #repository ⇒ MultiGit::Repository
-
#update(new) ⇒ MultiGit::Object, ...
abstract
Finally carry out the update.
Constructor Details
#initialize(ref) ⇒ Updater
Returns a new instance of Updater.
43 44 45 |
# File 'lib/multi_git/ref.rb', line 43 def initialize(ref) self.ref = ref end |
Instance Attribute Details
#target ⇒ MultiGit::Object, ... (readonly)
27 28 29 |
# File 'lib/multi_git/ref.rb', line 27 def target @target end |
Instance Method Details
#destroy! ⇒ Object
Release all resources used by this updater.
63 64 |
# File 'lib/multi_git/ref.rb', line 63 def destroy! end |
#name ⇒ String
38 39 40 |
# File 'lib/multi_git/ref.rb', line 38 def name @ref.name end |
#repository ⇒ MultiGit::Repository
33 34 35 |
# File 'lib/multi_git/ref.rb', line 33 def repository @ref.repository end |
#update(new) ⇒ MultiGit::Object, ...
This method is abstract.
Finally carry out the update.
52 53 54 55 56 57 58 59 60 |
# File 'lib/multi_git/ref.rb', line 52 def update(new) nx = case new when Ref, nil then new when Object, Builder then repository.write(new) else raise Error::InvalidReferenceTarget, new end @target = nx return nx end |