Skip to content

nested structure assignment

tqbf edited this page Sep 13, 2010 · 2 revisions

Nested Structure Assignment

You have:


class Foo < Ruckus::Structure
    le32 :a
    le32 :b
end

class Bar < Ruckus::Structure
    foo :payload
    le32 :code
end

You want to fill in the “payload” of a “Bar”. Before, you had to assign each field manually. Now, you should just be able to pass an already-completed “Foo” in:


b = Bar.new :with_payload => foostructure

Handy for proxying and responding to things.

Clone this wiki locally