Class: Darcs::Chunk::Hunk
Overview
Chunk which makes a modification to a text file. If the file is binary, you will need to use Darcs::Chunk::Binary instead
FIXME: We should create aggregate chunks to do a lot of the foot work for diffing, what not. An AddFileWithData chunk, A DiffFile chunk, whatnot. Or maybe a different method will present itself?
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, line, data) ⇒ Hunk
constructor
Creates a new hunk chunk for the specified file and line.
- #write(io, patch) ⇒ Object
Constructor Details
#initialize(path, line, data) ⇒ Hunk
Creates a new hunk chunk for the specified file and line.
88 89 90 91 92 |
# File 'lib/darcs/patchwriter.rb', line 88 def initialize(path, line, data) @path = path @line = line @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
94 95 96 |
# File 'lib/darcs/patchwriter.rb', line 94 def data @data end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
94 95 96 |
# File 'lib/darcs/patchwriter.rb', line 94 def line @line end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
94 95 96 |
# File 'lib/darcs/patchwriter.rb', line 94 def path @path end |
Instance Method Details
#write(io, patch) ⇒ Object
96 97 98 |
# File 'lib/darcs/patchwriter.rb', line 96 def write(io, patch) io.write("hunk #{path} #{line}\n#{data}") end |