lib/reckon/app.rb in reckon-0.4.1 vs lib/reckon/app.rb in reckon-0.4.2
- old
+ new
@@ -37,10 +37,13 @@
def already_seen?(row)
seen[row[:pretty_date]] && seen[row[:pretty_date]][row[:pretty_money]]
end
def extract_account_tokens(subtree, account = nil)
- if subtree.is_a?(Array)
+ if subtree.nil?
+ puts "Warning: empty #{account} tree"
+ {}
+ elsif subtree.is_a?(Array)
{ account => subtree }
else
at = subtree.map { |k, v| extract_account_tokens(v, [account, k].compact.join(':')) }
at.inject({}) { |k, v| k = k.merge(v)}
end