Class: R10K::Git::Alternates

Inherits:
Object
  • Object
show all
Defined in:
lib/r10k/git/alternates.rb

Overview

Manage ‘$GIT_DIR/objects/info/alternates`

See Also:

  • gitrepository-layout(5)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(git_dir) ⇒ Alternates

Returns a new instance of Alternates.

Parameters:

  • git_dir (String)

    The path to the git repository



13
14
15
# File 'lib/r10k/git/alternates.rb', line 13

def initialize(git_dir)
  @file = Pathname.new(File.join(git_dir, 'objects', 'info', 'alternates'))
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



10
11
12
# File 'lib/r10k/git/alternates.rb', line 10

def file
  @file
end

Instance Method Details

#<<(path) ⇒ Object



21
22
23
# File 'lib/r10k/git/alternates.rb', line 21

def <<(path)
  write(to_a << path)
end

#include?(path) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/r10k/git/alternates.rb', line 25

def include?(path)
  to_a.include?(path)
end

#to_aObject



17
18
19
# File 'lib/r10k/git/alternates.rb', line 17

def to_a
  read()
end