Module: IOStruct::DecInspect

Includes:
InspectBase
Defined in:
lib/iostruct.rb

Constant Summary collapse

DEC_FMTS =
{ 1 => "%4d", 2 => "%6d", 4 => "%11d", 8 => "%20d" }.freeze

Constants included from InspectBase

InspectBase::INT_MASKS

Instance Method Summary collapse

Methods included from InspectBase

#inspect, #to_s, #to_table

Instance Method Details

#format_int(value, size, fname) ⇒ Object



203
204
205
206
# File 'lib/iostruct.rb', line 203

def format_int(value, size, fname)
  fmt = DEC_FMTS[size] || raise("Unsupported Integer size #{size} for field #{fname}")
  fmt % value
end