Class: Baikal::Hexdump::Field::Offset

Inherits:
Baikal::Hexdump::Field show all
Defined in:
lib/baikal/hexdump.rb

Overview

The Offset field outputs the offset of a hexdump row, formatted via a printf template.

Instance Method Summary collapse

Constructor Details

#initialize(template) ⇒ Offset

Returns a new instance of Offset.



70
71
72
73
74
# File 'lib/baikal/hexdump.rb', line 70

def initialize template
  super()
  @template = template
  return
end

Instance Method Details

#format(row) ⇒ Object



76
77
78
# File 'lib/baikal/hexdump.rb', line 76

def format row
  return sprintf(@template, row.offset)
end