Class: ADT::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/adt/header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_countObject (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_offsetObject (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_countObject (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_lengthObject (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_headerObject



14
15
16
# File 'lib/adt/header.rb', line 14

def unpack_header
  @data.unpack('@24 I x4 I I')
end