class AUB::Payroll::EPFFile

Attributes

header[RW]
rows[RW]

Public Class Methods

new(company_name:, date:, transactions:) click to toggle source
# File lib/aub/payroll/epf_file.rb, line 14
def initialize(company_name:, date:, transactions:)
  @header = Header.new company_name: company_name, date: date
  @rows = transactions.map { |transaction| Row.new transaction }
  @footer = Footer.new number_of_records: rows.count, total_amount: rows.sum(&:amount)
end

Public Instance Methods

content() click to toggle source
# File lib/aub/payroll/epf_file.rb, line 20
def content
  [
    header,
    rows,
    footer,
  ].join("\r\n")
end