Class: LSVplus::TotalRecordFormatter

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

Constant Summary collapse

TYPE =
'890'
VERSION =
'0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ TotalRecordFormatter

Returns a new instance of TotalRecordFormatter.



14
15
16
# File 'lib/lsv_plus/total_record_formatter.rb', line 14

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



8
9
10
# File 'lib/lsv_plus/total_record_formatter.rb', line 8

def file
  @file
end

Class Method Details

.call(file) ⇒ Object



10
11
12
# File 'lib/lsv_plus/total_record_formatter.rb', line 10

def self.call(file)
  new(file).call
end

Instance Method Details

#callObject



18
19
20
# File 'lib/lsv_plus/total_record_formatter.rb', line 18

def call
  [TYPE, VERSION, creation_date, creator_identification, record_number, currency, total_amount].join('')
end

#creation_dateObject



22
23
24
# File 'lib/lsv_plus/total_record_formatter.rb', line 22

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

#creator_identificationObject



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

def creator_identification
  file.creator_identification
end

#currencyObject



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

def currency
  file.currency
end

#record_numberObject



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

def record_number
  LSVplus::FormattingHelper.index file.records.length
end

#total_amountObject



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

def total_amount
  LSVplus::FormattingHelper.amount file.total
end