Class: Database::TreeDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/database/tree_diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database) ⇒ TreeDiff

Returns a new instance of TreeDiff.



6
7
8
9
# File 'lib/database/tree_diff.rb', line 6

def initialize(database)
  @database = database
  @changes  = {}
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



4
5
6
# File 'lib/database/tree_diff.rb', line 4

def changes
  @changes
end

Instance Method Details

#compare_oids(a, b, filter) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/database/tree_diff.rb', line 11

def compare_oids(a, b, filter)
  return if a == b

  a_entries = a ? oid_to_tree(a).entries : {}
  b_entries = b ? oid_to_tree(b).entries : {}

  detect_deletions(a_entries, b_entries, filter)
  detect_additions(a_entries, b_entries, filter)
end