Class: Database::TreeDiff
- Inherits:
-
Object
- Object
- Database::TreeDiff
- Defined in:
- lib/database/tree_diff.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
Instance Method Summary collapse
- #compare_oids(a, b, prefix = Pathname.new("")) ⇒ Object
-
#initialize(database, prune = []) ⇒ TreeDiff
constructor
A new instance of TreeDiff.
Constructor Details
#initialize(database, prune = []) ⇒ TreeDiff
Returns a new instance of TreeDiff.
8 9 10 11 12 13 |
# File 'lib/database/tree_diff.rb', line 8 def initialize(database, prune = []) @database = database @changes = {} build_routing_table(prune) end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
6 7 8 |
# File 'lib/database/tree_diff.rb', line 6 def changes @changes end |
Instance Method Details
#compare_oids(a, b, prefix = Pathname.new("")) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/database/tree_diff.rb', line 15 def compare_oids(a, b, prefix = Pathname.new("")) 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, prefix) detect_additions(a_entries, b_entries, prefix) end |