Class: Darcs::Chunk::Binary

Inherits:
Base
  • Object
show all
Defined in:
lib/darcs/patchwriter.rb

Overview

Chunk which replaces a binary file’s contents

Constant Summary collapse

ENCODED_LINE_LENGTH =
78

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, old, new) ⇒ Binary

Creates a new Binary chunk. Old and new data are in their binary (non-encoded) form.



108
109
110
111
112
# File 'lib/darcs/patchwriter.rb', line 108

def initialize(path, old, new)
  @path = path
  @old = old
  @new = new
end

Instance Attribute Details

#newObject (readonly)

Returns the value of attribute new.



114
115
116
# File 'lib/darcs/patchwriter.rb', line 114

def new
  @new
end

#oldObject (readonly)

Returns the value of attribute old.



114
115
116
# File 'lib/darcs/patchwriter.rb', line 114

def old
  @old
end

#pathObject (readonly)

Returns the value of attribute path.



114
115
116
# File 'lib/darcs/patchwriter.rb', line 114

def path
  @path
end

Instance Method Details

#write(io, patch) ⇒ Object



116
117
118
# File 'lib/darcs/patchwriter.rb', line 116

def write(io, patch)
  io.write("binary #{path}\noldhex\n#{hex_encode old}newhex\n#{hex_encode new}")
end