class FakeGit::CatFile

Public Instance Methods

call(*args) click to toggle source
# File lib/fake_git/cat_file.rb, line 5
def call(*args)
  obj = FakeGit::FetchObject.new.call(args.first)

  return file_size(obj) if $OPTIONS[:cat_file_size]
  return file_print(obj) if $OPTIONS[:cat_file_print]
  return file_type(obj) if $OPTIONS[:cat_file_type]
end

Private Instance Methods

file_print(obj) click to toggle source
# File lib/fake_git/cat_file.rb, line 19
def file_print(obj)
  puts obj.content
end
file_size(obj) click to toggle source
# File lib/fake_git/cat_file.rb, line 14
def file_size(obj)
  result = `du -h #{obj.path}`
  puts result.split.first
end
file_type(obj) click to toggle source
# File lib/fake_git/cat_file.rb, line 23
def file_type(obj)
  puts obj.type
end