Class: BankPayments::SwedbankExport::File

Inherits:
Object
  • Object
show all
Defined in:
lib/bank_payments/swedbank_export/file.rb

Overview

Contains international payments to be made to foreign beneficiaries. The file contains one or more sequnces containing payments.

Author:

  • Michael Litton

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ File

Returns a new instance of File.



10
11
12
13
# File 'lib/bank_payments/swedbank_export/file.rb', line 10

def initialize(file_name)
  @file_name = file_name
  @sequences = []
end

Instance Attribute Details

#file_nameObject

Returns the value of attribute file_name.



8
9
10
# File 'lib/bank_payments/swedbank_export/file.rb', line 8

def file_name
  @file_name
end

Instance Method Details

#<<(sequence) ⇒ Object

Adds a sequence to the file



16
17
18
# File 'lib/bank_payments/swedbank_export/file.rb', line 16

def <<(sequence)
  @sequences << sequence
end

#to_file_dataObject



20
21
22
23
24
# File 'lib/bank_payments/swedbank_export/file.rb', line 20

def to_file_data
  sequence_data = @sequences.map { |sequence| sequence.to_file_data }

  sequence_data.join("\n").encode('iso-8859-1')
end