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.



37
38
39
40
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 37

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

Instance Attribute Details

#gitObject (readonly)

Returns the value of attribute git.



35
36
37
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 35

def git
  @git
end

#subpathObject (readonly)

Returns the value of attribute subpath.



35
36
37
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 35

def subpath
  @subpath
end

Instance Method Details

#deleteObject



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

def delete
  path.unlink
end

#pathObject



42
43
44
# File 'lib/eac_git/rspec/stubbed_git_local_repo.rb', line 42

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

#touchObject



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

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

#write(content) ⇒ Object



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

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