class Keepr::ContactExport
Public Class Methods
new(accounts, header_options = {}, &block)
click to toggle source
# File lib/keepr/contact_export.rb, line 4 def initialize(accounts, header_options = {}, &block) raise ArgumentError unless block_given? @accounts = accounts @header_options = header_options @block = block end
Public Instance Methods
to_file(filename)
click to toggle source
# File lib/keepr/contact_export.rb, line 16 def to_file(filename) export.to_file(filename) end
to_s()
click to toggle source
# File lib/keepr/contact_export.rb, line 12 def to_s export.to_s end
Private Instance Methods
export()
click to toggle source
# File lib/keepr/contact_export.rb, line 22 def export export = Datev::ContactExport.new(@header_options) @accounts.reorder(:number).each do |account| export << to_datev(account) if account.debtor? || account.creditor? end export end
to_datev(account)
click to toggle source
# File lib/keepr/contact_export.rb, line 32 def to_datev(account) { 'Konto' => account.number }.merge(@block.call(account)) end