Class: DBF::Header
- Inherits:
-
Object
- Object
- DBF::Header
- Defined in:
- lib/dbf/header.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
readonly
Returns the value of attribute encoding.
-
#encoding_key ⇒ Object
readonly
Returns the value of attribute encoding_key.
-
#header_length ⇒ Object
readonly
Returns the value of attribute header_length.
-
#record_count ⇒ Object
readonly
Returns the value of attribute record_count.
-
#record_length ⇒ Object
readonly
Returns the value of attribute record_length.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(data) ⇒ Header
constructor
A new instance of Header.
- #unpack_header ⇒ Object
Constructor Details
#initialize(data) ⇒ Header
Returns a new instance of Header.
10 11 12 13 14 |
# File 'lib/dbf/header.rb', line 10 def initialize(data) @data = data @version, @record_count, @header_length, @record_length, @encoding_key = unpack_header @encoding = DBF::ENCODINGS[@encoding_key] end |
Instance Attribute Details
#encoding ⇒ Object (readonly)
Returns the value of attribute encoding.
8 9 10 |
# File 'lib/dbf/header.rb', line 8 def encoding @encoding end |
#encoding_key ⇒ Object (readonly)
Returns the value of attribute encoding_key.
7 8 9 |
# File 'lib/dbf/header.rb', line 7 def encoding_key @encoding_key end |
#header_length ⇒ Object (readonly)
Returns the value of attribute header_length.
5 6 7 |
# File 'lib/dbf/header.rb', line 5 def header_length @header_length end |
#record_count ⇒ Object (readonly)
Returns the value of attribute record_count.
4 5 6 |
# File 'lib/dbf/header.rb', line 4 def record_count @record_count end |
#record_length ⇒ Object (readonly)
Returns the value of attribute record_length.
6 7 8 |
# File 'lib/dbf/header.rb', line 6 def record_length @record_length end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/dbf/header.rb', line 3 def version @version end |
Instance Method Details
#unpack_header ⇒ Object
16 17 18 |
# File 'lib/dbf/header.rb', line 16 def unpack_header @data.unpack('H2 x3 V v2 x17H2') end |