class Keepr::AccountExport

Public Class Methods

new(accounts, header_options = {}, &block) click to toggle source
# File lib/keepr/account_export.rb, line 4
def initialize(accounts, header_options = {}, &block)
  @accounts = accounts
  @header_options = header_options
  @block = block
end

Private Instance Methods

export() click to toggle source
# File lib/keepr/account_export.rb, line 15
def export
  export = Datev::AccountExport.new(@header_options)

  @accounts.reorder(:number).each do |account|
    export << to_datev(account) unless account.debtor? || account.creditor?
  end

  export
end
to_datev(account) click to toggle source
# File lib/keepr/account_export.rb, line 25
def to_datev(account)
  {
    'Konto'              => account.number,
    'Kontenbeschriftung' => account.name.slice(0, 40)
  }.merge(@block ? @block.call(account) : {})
end