class Elf::Utilities::OffsetTable

Public Class Methods

new(content, separator) click to toggle source
# File lib/elf/utils/offsettable.rb, line 28
def initialize(content, separator)
  @content = content
  @separator = separator
end

Public Instance Methods

[](idx) click to toggle source
# File lib/elf/utils/offsettable.rb, line 37
def [](idx)
  raise InvalidIndex.new(idx, size) if idx >= size

  # find the first occurrence of the separator starting from the
  # given index
  endidx = @content.index(@separator, idx)

  return @content[idx..endidx].chomp(@separator)
end
size() click to toggle source
# File lib/elf/utils/offsettable.rb, line 33
def size
  @content.size
end