Class: Kirico::Form

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/kirico/models/form.rb

Constant Summary collapse

FILE_NAME =
'SHFD0006.CSV'

Instance Method Summary collapse

Constructor Details

#initialize(fd:, company_count: Kirico::CompanyCount.new, company:, records: []) ⇒ Form

Returns a new instance of Form.



21
22
23
24
25
26
# File 'lib/kirico/models/form.rb', line 21

def initialize(fd:, company_count: Kirico::CompanyCount.new, company:, records: [])
  @fd = fd
  @company_count = company_count
  @company = company
  @records = records
end

Instance Method Details

#to_csvObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kirico/models/form.rb', line 28

def to_csv
  [
    @fd.to_csv,
    Kirico::CompanyIdentifier.new.to_csv,
    @company_count.to_csv,
    @company.to_csv,
    Kirico::DataIdentifier.new.to_csv,
    @records.map(&:to_csv).join("\r\n"),
    ''
  ].join("\r\n")
end