Class: Hotfile::Record::BCH02

Inherits:
Hotfile::Record show all
Defined in:
lib/hotfile/record/BCH02.rb

Overview

Billing Analysis (Cycle) Header Record

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ BCH02

Returns a new instance of BCH02.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/hotfile/record/BCH02.rb', line 7

def initialize(line)
  super

  processing_date, cycle, billing_end_date, run_id, reporting_end_date, reserved =
    line.scan(/
      ([A-Z0-9]{3})
      (\d)
      (\d{6})
      ([A-Z0-9])
      (\d{6})
      (.{106})
    /x).flatten

  @data = {
    processing_date: processing_date,
    cycle: cycle.to_i,
    billing_end_date: Hotfile::Date.new(billing_end_date).to_date,
    run: run_id,
    reporting_end_date: Hotfile::Date.new(reporting_end_date).to_date,
    reserved: reserved.strip
  }
end