Class: Bai2::BaiFile
- Inherits:
-
Object
- Object
- Bai2::BaiFile
- Extended by:
- AttrReaderFromIvarHash
- Defined in:
- lib/bai2.rb,
lib/bai2/integrity.rb
Overview
This class is the main wrapper around a Bai2 file.
Defined Under Namespace
Classes: Account, Group, IntegrityError, Transaction
Constant Summary collapse
- DEFAULT_OPTIONS =
{ account_control_ignores_summary_amounts: false, num_account_summary_continuation_records: 0, continuations_slash_delimit_end_of_line_only: false, }.freeze
Instance Attribute Summary collapse
-
#groups ⇒ Object
readonly
The groups contained within this file.
-
#raw ⇒ Object
readonly
This is the raw data.
Class Method Summary collapse
-
.parse(path, options = {}) ⇒ Object
Parse a file on disk:.
Instance Method Summary collapse
- #file_creation_datetime ⇒ Object
-
#initialize(raw, options = {}) ⇒ BaiFile
constructor
Parse a Bai2 data buffer:.
Methods included from AttrReaderFromIvarHash
Constructor Details
#initialize(raw, options = {}) ⇒ BaiFile
Parse a Bai2 data buffer:
f = BaiFile.new(bai2_data)
32 33 34 35 36 37 |
# File 'lib/bai2.rb', line 32 def initialize(raw, = {}) @raw = raw @groups = [] @options = DEFAULT_OPTIONS.merge() parse(raw, ) end |
Instance Attribute Details
#groups ⇒ Object (readonly)
The groups contained within this file.
43 44 45 |
# File 'lib/bai2.rb', line 43 def groups @groups end |
#raw ⇒ Object (readonly)
This is the raw data. Probably not super important.
40 41 42 |
# File 'lib/bai2.rb', line 40 def raw @raw end |
Class Method Details
.parse(path, options = {}) ⇒ Object
Parse a file on disk:
f = BaiFile.parse('myfile.bai2')
23 24 25 |
# File 'lib/bai2.rb', line 23 def self.parse(path, = {}) self.new(File.read(path), ) end |
Instance Method Details
#file_creation_datetime ⇒ Object
55 56 57 |
# File 'lib/bai2.rb', line 55 def file_creation_datetime @header[:file_creation_date] + @header[:file_creation_time] end |