module Toys::StandardMixins::GitCache

A mixin that provides a git cache.

This mixin provides an instance of {Toys::Utils::GitCache}, providing cached access to files from a remote git repo.

Example usage:

include :git_cache

def run
  # Pull and cache the HEAD commit from the Toys repo.
  dir = git_cache.find("https://github.com/dazuma/toys.git")
  # Display the contents of the readme file.
  puts File.read(File.join(dir, "README.md"))
end

Constants

KEY

Context key for the GitCache object. @return [Object]

Public Instance Methods

git_cache() click to toggle source

Access the builtin GitCache.

@return [Toys::Utils::GitCache]

# File lib/toys/standard_mixins/git_cache.rb, line 43
def git_cache
  self[KEY]
end