Method: Rex::Struct2::SString#to_s
- Defined in:
- lib/rex/struct2/s_string.rb
#to_s ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rex/struct2/s_string.rb', line 36 def to_s string = self.value return if !string # pad if short if restraint && restraint.min && self.pad && restraint.min > string.length string += self.pad * (restraint.min - string.length) end # truncate if long if restraint && restraint.max string = string.slice(0, restraint.max) end return string end |