Class: FlatKit::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/flat_kit/position.rb

Overview

The information about the position of a record in an IO stream

Generally this is going to be returned by a write_record method to return information about the record that was just written

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index: nil, offset: nil, bytesize: nil) ⇒ Position

Returns a new instance of Position.



12
13
14
15
16
# File 'lib/flat_kit/position.rb', line 12

def initialize(index: nil, offset: nil, bytesize: nil)
  @index    = index
  @offset   = offset
  @bytesize = bytesize
end

Instance Attribute Details

#bytesizeObject (readonly)

zero based # byte offset in the IO stream # byte length of the record



10
11
12
# File 'lib/flat_kit/position.rb', line 10

def bytesize
  @bytesize
end

#indexObject (readonly)

zero based # byte offset in the IO stream # byte length of the record



10
11
12
# File 'lib/flat_kit/position.rb', line 10

def index
  @index
end

#offsetObject (readonly)

zero based # byte offset in the IO stream # byte length of the record



10
11
12
# File 'lib/flat_kit/position.rb', line 10

def offset
  @offset
end