Method: Rex::Struct2::CStruct#apply_restraint

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

#apply_restraint(*ress) ⇒ Object

apply_restraint( name, restraint, name2, restraint2 … )



113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/rex/struct2/c_struct.rb', line 113

def apply_restraint(*ress)
  while ress.length >= 2
    name = ress.shift
    res  = ress.shift
    self[name].restraint = res

    # update the restrainted object, so it will update the value
    # of the restrainter, with the initial size.  If you don't
    # want this behavior, um, you'll have to be careful with what
    # you supply as default values...
    self[name].update_restraint
  end
  return self
end