Class: LCSP::LCSPCache

Inherits:
Object
  • Object
show all
Defined in:
lib/common/cache.rb

Overview

Base LCSP cache

Instance Method Summary collapse

Constructor Details

#initialize(user, repository) ⇒ LCSPCache

Initializes a new instance of LCSPCache.

Parameters:

  • user (String)

    The GitHub username of the repository owner.

  • repository (String)

    The name of the repository.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/common/cache.rb', line 16

def initialize(user, repository)
  @user = user
  @repository = repository

  return if exists?

  ::Git.clone(
    URI("https://github.com/#{@user}/#{@repository.downcase}"),
    ::Pathname.new("cache_#{@user}-#{@repository.downcase}")
  )
end

Instance Method Details

#pathString

Returns the path to the local cache directory for the specified repository.

Returns:

  • (String)

    The path to the local cache directory.



31
32
33
# File 'lib/common/cache.rb', line 31

def path
  "#{::Dir.pwd}/cache_#{@user}-#{@repository.downcase}"
end