Class: ADT::Header
- Inherits:
-
Object
- Object
- ADT::Header
- Defined in:
- lib/adt/header.rb
Instance Attribute Summary collapse
-
#column_count ⇒ Object
readonly
Returns the value of attribute column_count.
-
#data_offset ⇒ Object
readonly
Returns the value of attribute data_offset.
-
#record_count ⇒ Object
readonly
Returns the value of attribute record_count.
-
#record_length ⇒ Object
readonly
Returns the value of attribute record_length.
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.
8 9 10 11 12 |
# File 'lib/adt/header.rb', line 8 def initialize(data) @data = data @record_count, @data_offset, @record_length = unpack_header @column_count = (@data_offset - 400) / 200 end |
Instance Attribute Details
#column_count ⇒ Object (readonly)
Returns the value of attribute column_count.
6 7 8 |
# File 'lib/adt/header.rb', line 6 def column_count @column_count end |
#data_offset ⇒ Object (readonly)
Returns the value of attribute data_offset.
4 5 6 |
# File 'lib/adt/header.rb', line 4 def data_offset @data_offset end |
#record_count ⇒ Object (readonly)
Returns the value of attribute record_count.
3 4 5 |
# File 'lib/adt/header.rb', line 3 def record_count @record_count end |
#record_length ⇒ Object (readonly)
Returns the value of attribute record_length.
5 6 7 |
# File 'lib/adt/header.rb', line 5 def record_length @record_length end |
Instance Method Details
#unpack_header ⇒ Object
14 15 16 |
# File 'lib/adt/header.rb', line 14 def unpack_header @data.unpack('@24 I x4 I I') end |