Method: Rex::Struct2::Generic#to_s

Defined in:
lib/rex/struct2/generic.rb

#to_sObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rex/struct2/generic.rb', line 37

def to_s
  # I realize this will bomb out if this isn't an integer, for
  # example if it is nil.  That should only happen for a user
  # error so that's what I want it to do...
  string = [ @value ].pack(@packspec)

  if restraint && restraint.max
    return string.slice(0, restraint.max)
  else
    return string
  end
  # what to do for restraint.min?!?
end