Sha256: 0ecda829d02311cb8c9e61c0c2acbf2262e54f4ca4ce0a92a6967a0bcda90683
Contents?: true
Size: 698 Bytes
Versions: 1
Compression:
Stored size: 698 Bytes
Contents
require "active_model" module AUB module Payroll class File extend ActiveSupport::Autoload autoload :Header autoload :Row autoload :Footer include ActiveModel::Model 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 def content [ header, rows, footer, ].join("\r\n") end private attr_accessor :header, :rows, :footer end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aub-payroll-0.1.0 | lib/aub/payroll/file.rb |