Method: Rex::Struct2::CStruct#create_restraints

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

#create_restraints(*ress) ⇒ Object

create_restraints( [ name, stuff_to_restraint_constructor ] … )



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/rex/struct2/c_struct.rb', line 129

def create_restraints(*ress)
  ress.each { |r|
    # make a copy before we modify...
    r = r.dup
    # resolve names into objects
    r[1] = self[r[1]] if r[1]
    r[2] = self[r[2]] if r[2]

    # build and apply the restraint
    self.apply_restraint(r[0], Rex::Struct2::Restraint.new(*r[1 .. -1]))
  }

  return self
end