class FakeGit::FetchObject

Constants

OBJ_PATH

Public Instance Methods

call(*args) click to toggle source
# File lib/fake_git/fetch_object.rb, line 6
def call(*args)
  index, _ = args.first.split(" ")
  path = file_path(index)
  build_obj(path)
end

Private Instance Methods

build_obj(path) click to toggle source
# File lib/fake_git/fetch_object.rb, line 13
def build_obj(path)
  content = File.read(path)
  attributes = Hash.new

  content.split(",").each do |c|
    key, val = c.split("=")
    attributes[key.to_sym] = val
  end

  FakeGit::Priv::Object.new(
    attributes.merge(path: path)
  )
end
file_path(arg) click to toggle source
# File lib/fake_git/fetch_object.rb, line 27
def file_path(arg)
  "#{OBJ_PATH}/#{arg[0..1]}/#{arg[2..-1]}"
end