Class: Amp::Git::VersionedWorkingFile

Inherits:
VersionedFile
  • Object
show all
Defined in:
lib/amp-git/repo_format/versioned_file.rb

Overview

This is a VersionedFile, except it’s in the working directory, so its data is stored on disk in the actual file. Other than that, it’s basically the same in its interface!

Instance Attribute Summary

Attributes inherited from VersionedFile

#path, #repo, #revision

Instance Method Summary collapse

Methods inherited from VersionedFile

#==, #cmp, #flags, #hash, #renamed?

Constructor Details

#initialize(repo, path, opts = {}) ⇒ VersionedWorkingFile

Initializes a new working dir file - slightly different semantics here



115
116
117
# File 'lib/amp-git/repo_format/versioned_file.rb', line 115

def initialize(repo, path, opts={})
  super(repo, path, opts)
end

Instance Method Details

#changesetObject



127
128
129
# File 'lib/amp-git/repo_format/versioned_file.rb', line 127

def changeset
  WorkingDirectoryChangeset.new repo
end

#dataObject



123
124
125
# File 'lib/amp-git/repo_format/versioned_file.rb', line 123

def data
  File.read repo.working_join(path)
end

#sizeObject



119
120
121
# File 'lib/amp-git/repo_format/versioned_file.rb', line 119

def size
  File.stat(repo.join(path)).size
end