module FileData::ClassMethods
Class Methods¶ ↑
Defines behavior for subclasses of Flat::File
regarding the management of its internal data structures.
Public Instance Methods
Convenience method for accessing flat_file_data[:fields]
Returns an Array
of Field::Definitions
# File lib/flat/file_data.rb, line 39 def fields flat_file_data[:fields] end
Container for various points of data as defined in the Flat::File
subclass.
Returns a Hash
with the following keys:
-
:width
- The overall width, or length, of a line in the flat file. -
:pack_format
- A formatString
for use by String#unpack. -
:fields
- AnArray
of Field::Definitions -
:layouts
- AnArray
of Layout::Definitions
# File lib/flat/file_data.rb, line 25 def flat_file_data @data ||= { :width => 0, :pack_format => '', :fields => [], :layouts => [], } end
Convenience method for accessing flat_file_data[:layouts]
Returns an Array
of Layout::Definitions
# File lib/flat/file_data.rb, line 74 def layouts flat_file_data[:layout] end
Convenience method for accessing flat_file_data[:pack_format]
Returns a String
sutiable for use with String#unpack
# File lib/flat/file_data.rb, line 65 def pack_format flat_file_data[:pack_format] end
Convenience method for accessing flat_file_data[:width]
Returns the overall length of a line to text in the flat file.
# File lib/flat/file_data.rb, line 48 def width flat_file_data[:width] end