Class: Pack::Delta

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pack/delta.rb

Defined Under Namespace

Classes: Copy, Insert

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, target) ⇒ Delta

Returns a new instance of Delta.



40
41
42
43
44
45
46
47
48
# File 'lib/pack/delta.rb', line 40

def initialize(source, target)
  @base = source.entry
  @data = sizeof(source) + sizeof(target)

  source.delta_index ||= XDelta.create_index(source.data)

  delta = source.delta_index.compress(target.data)
  delta.each { |op| @data.concat(op.to_s) }
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



38
39
40
# File 'lib/pack/delta.rb', line 38

def base
  @base
end

#dataObject (readonly)

Returns the value of attribute data.



38
39
40
# File 'lib/pack/delta.rb', line 38

def data
  @data
end