Class: MultiGit::RuggedBackend::Ref
- Inherits:
-
Object
- Object
- MultiGit::RuggedBackend::Ref
- Includes:
- MultiGit::Ref
- Defined in:
- lib/multi_git/rugged_backend/ref.rb
Defined Under Namespace
Classes: OptimisticUpdater, PessimisticUpdater, Updater
Instance Attribute Summary
Attributes included from MultiGit::Ref
Instance Method Summary collapse
-
#initialize(repository, name) ⇒ Ref
constructor
private
A new instance of Ref.
- #target ⇒ Object
Methods included from MultiGit::Ref
#[], #commit, #delete, #detached?, #direct?, #exists?, #reload, #resolve, #symbolic?, #update
Methods included from Utils::AbstractMethods
Constructor Details
#initialize(repository, name) ⇒ Ref
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Ref.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/multi_git/rugged_backend/ref.rb', line 11 def initialize(repository, name) if name.kind_of? Rugged::Reference ref = name name = ref.name else ref = Rugged::Reference.lookup(repository.__backend__, name) end super(repository, name) @rugged_ref = ref end |
Instance Method Details
#target ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/multi_git/rugged_backend/ref.rb', line 22 def target return nil unless rugged_ref @target ||= begin if rugged_ref.type == :symbolic repository.ref(rugged_ref.target) else repository.read(rugged_ref.target) end end end |