Module: LSVplus::FormattingHelper

Defined in:
lib/lsv_plus/formatting_helper.rb

Constant Summary collapse

DATE_FORMAT =
'%Y%m%d'

Class Method Summary collapse

Class Method Details

.account(account) ⇒ Object



26
27
28
# File 'lib/lsv_plus/formatting_helper.rb', line 26

def self.()
  format '%-34s', 
end

.amount(amount) ⇒ Object



13
14
15
# File 'lib/lsv_plus/formatting_helper.rb', line 13

def self.amount(amount)
  format('%012.2f', amount).sub('.', ',')
end

.clearing_number(number) ⇒ Object



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

def self.clearing_number(number)
  format '%-5s', number
end

.date(date) ⇒ Object



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

def self.date(date)
  date.strftime DATE_FORMAT
end

.index(index) ⇒ Object



9
10
11
# File 'lib/lsv_plus/formatting_helper.rb', line 9

def self.index(index)
  format '%07d', index
end

.multiline(lines) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/lsv_plus/formatting_helper.rb', line 17

def self.multiline(lines)
  lines_string = StringIO.new
  4.times do |index|
    lines_string.write format('%-35s', lines[index])
  end
  lines_string.rewind
  lines_string.read
end