Class: Guevara::BatchHeader

Inherits:
Row
  • Object
show all
Defined in:
lib/guevara/batch_header.rb

Instance Attribute Summary

Attributes inherited from Row

#attributes

Instance Method Summary collapse

Methods inherited from Row

#initialize, #to_s

Constructor Details

This class inherits a constructor from Guevara::Row

Instance Method Details

#default_attributesObject



7
8
9
10
11
# File 'lib/guevara/batch_header.rb', line 7

def default_attributes
  {
    discretionary_data: ''
  }
end

#fieldsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/guevara/batch_header.rb', line 20

def fields
  ["5",
   "%<service_class>3d",
   "%<company_name>-16.16s",
   "%<discretionary_data>-20.20s",
   "%<company_id>10.10s",
   "PPD",
   "%<entry_description>10.10s",
   "%<company_date>s",
   "%<effective_date>s",
   "   1",
   "%<origin_id>8d",
   "%<number>07d"]
end

#format_attributesObject



13
14
15
16
17
18
# File 'lib/guevara/batch_header.rb', line 13

def format_attributes
  attributes[:company_date] = Date.parse(attributes[:company_date]).
    strftime('%y%m%d')
  attributes[:effective_date] = Date.parse(attributes[:effective_date]).
    strftime('%y%m%d')
end