class F4R::Registry
Stores records and meta data for encoding and decoding
Attributes
definitions[RW]
Definitions for all records
@return [Array<Hash>]
header[R]
Main file header
@return [BinData::RecordHeader] header
records[RW]
Storage for all records including their meta data
@return [Hash]
Public Class Methods
new(header)
click to toggle source
# File lib/f4r.rb, line 1242 def initialize(header) @header = header @records = [] @definitions = [] end
Public Instance Methods
add(record, local_message_number)
click to toggle source
Add record to +@records+ [Array<Hash>]
@param [Hash] record @param [Integer] local_message_number
# File lib/f4r.rb, line 1254 def add(record, local_message_number) @records << { index: @records.size, message_name: record.message[:name], message_number: record.message[:number], message_source: record.message[:source], local_message_number: local_message_number, fields: record.fields } end
definition(record)
click to toggle source
Helper method to find the associated definitions with an specific record
@param [Hash] record @return [Hash]
# File lib/f4r.rb, line 1271 def definition(record) definitions.find do |d| d[:local_message_number] == record[:local_message_number] && d[:message_name] == record[:message_name] end end