class AccountTree
Public Instance Methods
deep_merge(h)
click to toggle source
deep merge merges two AccountTrees such that their sub-account-trees are merged as well frankly, I can not now work out why this code works but the specs pass and so.…
# File lib/rodger.rb, line 15 def deep_merge (h) self.merge(h) do |k, old, new| begin AccountTree.new(old).deep_merge(AccountTree.new(new)) rescue new end end end
leaf?()
click to toggle source
returns true if an account has no sub accounts
# File lib/rodger.rb, line 26 def leaf? (keys - [:name, :balance]).empty? end