module Rex::Struct2::Element
Attributes
container[RW]
elements should have to_s, but we don’t define it here because it will just overlap with inheritence and cause issues
restraint[RW]
elements should have to_s, but we don’t define it here because it will just overlap with inheritence and cause issues
value[R]
elements should have to_s, but we don’t define it here because it will just overlap with inheritence and cause issues
Public Instance Methods
slength()
click to toggle source
avoid conflicting with normal namespace length()
# File lib/rex/struct2/element.rb, line 21 def slength to_s().length() end
update_restraint()
click to toggle source
# File lib/rex/struct2/element.rb, line 25 def update_restraint if self.restraint # Sort of a hack, but remove the restraint before we update, so we aren't using # the old restraint during calculating the restraint update value old_restraint, self.restraint = self.restraint, nil old_restraint.update(self.slength) self.restraint = old_restraint end if self.container self.container.update_restraint end end
value=(newval)
click to toggle source
update the restraints on any value change
# File lib/rex/struct2/element.rb, line 15 def value=(newval) @value = newval self.update_restraint end