add top level accounts

This commit is contained in:
Gwenhael Le Moine 2015-09-03 16:55:41 +02:00
parent e74249cc11
commit 14dedcf779

View file

@ -19,13 +19,17 @@ module Ledger
end
def accounts( depth = 9999 )
run( '', 'accounts' )
.split( "\n" )
.map do |a|
accounts = run( '', 'accounts' )
.split( "\n" )
.map do |a|
a.split( ':' )
.each_slice( depth )
.to_a.first
.each_slice( depth )
.to_a.first
end.uniq
top_level_accounts = accounts.map(&:first).uniq.map { |account| [ account ] }
( accounts + top_level_accounts ).sort
end
def dates_salaries( category = 'salaire' )