Class: EacGit::Rspec::StubbedGitLocalRepo::StubbedGitRepositoryFile

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_git/rspec/stubbed_git_local_repo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(git, subpath) ⇒ StubbedGitRepositoryFile

Returns a new instance of StubbedGitRepositoryFile.



48
49
50
51
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 48

def initialize(git, subpath)
  @git = git
  @subpath = subpath
end

Instance Attribute Details

#gitObject (readonly)

Returns the value of attribute git.



46
47
48
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 46

def git
  @git
end

#subpathObject (readonly)

Returns the value of attribute subpath.



46
47
48
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 46

def subpath
  @subpath
end

Instance Method Details

#deleteObject



61
62
63
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 61

def delete
  path.unlink
end

#pathObject



53
54
55
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 53

def path
  git.root_path.join(*subpath)
end

#touchObject



57
58
59
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 57

def touch
  ::FileUtils.touch(path.to_path)
end

#write(content) ⇒ Object



65
66
67
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 65

def write(content)
  path.write(content)
end