Class: Headache::Record::BatchHeader

Inherits:
Base
  • Object
show all
Includes:
Definition::BatchHeader
Defined in:
lib/headache/record/batch_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

fields, #normalize_field_value, normalize_field_value, #parse, parse_fields, parse_fields_normalize, #to_h

Constructor Details

#initialize(batch = nil, document = nil) ⇒ BatchHeader

Returns a new instance of BatchHeader.



15
16
17
18
# File 'lib/headache/record/batch_header.rb', line 15

def initialize(batch = nil, document = nil)
  @batch    = batch
  @document = document
end

Instance Attribute Details

#batchObject

Returns the value of attribute batch.



6
7
8
# File 'lib/headache/record/batch_header.rb', line 6

def batch
  @batch
end

#documentObject

Returns the value of attribute document.



6
7
8
# File 'lib/headache/record/batch_header.rb', line 6

def document
  @document
end

Instance Method Details

#parse_fields(record_string) ⇒ Object



20
21
22
23
24
# File 'lib/headache/record/batch_header.rb', line 20

def parse_fields(record_string)
  fields = super
  type   = Headache::Batch.type_from_service_code(fields.delete :service_code)
  fields.merge(type: type)
end