class Baikal::Hexdump::Format
Describes a textual hexdump format.
Attributes
bytes_per_row[R]
fields[R]
rows_per_block[R]
Public Class Methods
new(bytes_per_row, fields, rows_per_block = 0)
click to toggle source
Creates a new Hexdump::Format
instance with the specified structure. bytes_per_row
specifies the number of bytes to be listed on every row; fields
(a list of Hexdump::Field
instances) contains the formatting rules. rows_per_block
, if given and nonzero, will cause an empty line to be printed after every block of that many rows.
Calls superclass method
# File lib/baikal/hexdump.rb, line 222 def initialize bytes_per_row, fields, rows_per_block = 0 super() @bytes_per_row = bytes_per_row @fields = fields @rows_per_block = rows_per_block return end
Public Instance Methods
format_row(row, port)
click to toggle source
Formats a given row
(an instance of Hexdump::Row
) according to formatting rules embodied in this Hexdump_Format
instance and outputs the result into the given port
# File lib/baikal/hexdump.rb, line 235 def format_row row, port raise 'Type mismatch' unless row.is_a? Hexdump::Row port.puts @fields.map{|field| field.format(row)}.join('') return end