Class: Headache::Record::FileControl

Inherits:
Base
  • Object
show all
Includes:
Definition::FileControl
Defined in:
lib/headache/record/file_control.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, parse_fields_normalize, #to_h

Constructor Details

#initialize(document = nil) ⇒ FileControl

Returns a new instance of FileControl.



8
9
10
# File 'lib/headache/record/file_control.rb', line 8

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

Instance Attribute Details

#documentObject

Returns the value of attribute document.



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

def document
  @document
end

Instance Method Details

#batch_countObject



12
13
14
# File 'lib/headache/record/file_control.rb', line 12

def batch_count
  document.batches.count
end

#block_countObject



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

def block_count
  (((batch_count * 2) + document.entries.count + 2) / 10.0).ceil
end

#entry_countObject



20
21
22
# File 'lib/headache/record/file_control.rb', line 20

def entry_count
  document.entries.count
end

#entry_hashObject



24
25
26
# File 'lib/headache/record/file_control.rb', line 24

def entry_hash
  batch_sum(:entry_hash).to_s.last(10)
end

#total_creditObject



32
33
34
# File 'lib/headache/record/file_control.rb', line 32

def total_credit
  batch_sum :total_credit
end

#total_debitObject



28
29
30
# File 'lib/headache/record/file_control.rb', line 28

def total_debit
  batch_sum :total_debit
end