Class: LSVplus::RecordFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/lsv_plus/record_formatter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, record, index) ⇒ RecordFormatter

Returns a new instance of RecordFormatter.



11
12
13
14
15
16
# File 'lib/lsv_plus/record_formatter.rb', line 11

def initialize(file, record, index)
  @file = file
  @record = record
  @index = index
  @output = StringIO.new
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



5
6
7
# File 'lib/lsv_plus/record_formatter.rb', line 5

def file
  @file
end

#outputObject (readonly)

Returns the value of attribute output.



5
6
7
# File 'lib/lsv_plus/record_formatter.rb', line 5

def output
  @output
end

#recordObject (readonly)

Returns the value of attribute record.



5
6
7
# File 'lib/lsv_plus/record_formatter.rb', line 5

def record
  @record
end

Class Method Details

.call(file, record, index) ⇒ Object



7
8
9
# File 'lib/lsv_plus/record_formatter.rb', line 7

def self.call(file, record, index)
  new(file, record, index).call
end

Instance Method Details

#amountObject



74
75
76
# File 'lib/lsv_plus/record_formatter.rb', line 74

def amount
  LSVplus::FormattingHelper.amount record.amount
end

#callObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/lsv_plus/record_formatter.rb', line 18

def call
  [
    type, version, processing_type, processing_date,
    creditor_bank_clearing_number, creation_date, debitor_bank_clearing_number,
    creator_identification, record_number, lsv_identification,
    currency, amount,
    creditor_iban, creditor_address,
    , debitor_address,
    message, reference_type, reference, esr_member_id
  ].join('')
end

#creation_dateObject



50
51
52
# File 'lib/lsv_plus/record_formatter.rb', line 50

def creation_date
  LSVplus::FormattingHelper.date file.creation_date
end

#creator_identificationObject



58
59
60
# File 'lib/lsv_plus/record_formatter.rb', line 58

def creator_identification
  file.creator_identification
end

#creditor_addressObject



82
83
84
# File 'lib/lsv_plus/record_formatter.rb', line 82

def creditor_address
  LSVplus::FormattingHelper.multiline record.creditor_address
end

#creditor_bank_clearing_numberObject



46
47
48
# File 'lib/lsv_plus/record_formatter.rb', line 46

def creditor_bank_clearing_number
  LSVplus::FormattingHelper.clearing_number record.creditor_bank_clearing_number
end

#creditor_ibanObject



78
79
80
# File 'lib/lsv_plus/record_formatter.rb', line 78

def creditor_iban
  LSVplus::FormattingHelper. record.creditor_iban
end

#currencyObject



70
71
72
# File 'lib/lsv_plus/record_formatter.rb', line 70

def currency
  file.currency
end

#debitor_accountObject



86
87
88
# File 'lib/lsv_plus/record_formatter.rb', line 86

def 
  LSVplus::FormattingHelper. record.
end

#debitor_addressObject



90
91
92
# File 'lib/lsv_plus/record_formatter.rb', line 90

def debitor_address
  LSVplus::FormattingHelper.multiline record.debitor_address
end

#debitor_bank_clearing_numberObject



54
55
56
# File 'lib/lsv_plus/record_formatter.rb', line 54

def debitor_bank_clearing_number
  LSVplus::FormattingHelper.clearing_number record.debitor_bank_clearing_number
end

#esr_member_idObject



106
107
108
# File 'lib/lsv_plus/record_formatter.rb', line 106

def esr_member_id
  format '%-9s', record.esr_member_id
end

#lsv_identificationObject



66
67
68
# File 'lib/lsv_plus/record_formatter.rb', line 66

def lsv_identification
  file.lsv_identification
end

#messageObject



94
95
96
# File 'lib/lsv_plus/record_formatter.rb', line 94

def message
  LSVplus::FormattingHelper.multiline record.message
end

#processing_dateObject



42
43
44
# File 'lib/lsv_plus/record_formatter.rb', line 42

def processing_date
  LSVplus::FormattingHelper.date record.processing_date
end

#processing_typeObject



38
39
40
# File 'lib/lsv_plus/record_formatter.rb', line 38

def processing_type
  file.processing_type
end

#record_numberObject



62
63
64
# File 'lib/lsv_plus/record_formatter.rb', line 62

def record_number
  LSVplus::FormattingHelper.index @index
end

#referenceObject



102
103
104
# File 'lib/lsv_plus/record_formatter.rb', line 102

def reference
  format '%-27s', record.reference
end

#reference_typeObject



98
99
100
# File 'lib/lsv_plus/record_formatter.rb', line 98

def reference_type
  record.reference_type
end

#typeObject



30
31
32
# File 'lib/lsv_plus/record_formatter.rb', line 30

def type
  record.type
end

#versionObject



34
35
36
# File 'lib/lsv_plus/record_formatter.rb', line 34

def version
  record.version
end