Class: FileGenerator::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/file_generator/base.rb

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



4
5
# File 'lib/file_generator/base.rb', line 4

def initialize()
end

Instance Method Details

#generate_file(records, headerformat, bodyformat, footerformat) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/file_generator/base.rb', line 7

def generate_file(records, headerformat, bodyformat, footerformat)
  file = []
  fh = process_hf(headerformat, records)
  file << fh
  records.each do |record|
    fb = process_body(bodyformat, record)
    file << fb
  end
  ff = process_hf(footerformat, records)
  file << ff
  file = file.join("\n")
  file
end