Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created February 17, 2011 22:38
Show Gist options
  • Select an option

  • Save zeroeth/832896 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/832896 to your computer and use it in GitHub Desktop.
class MyItems
# This will read in only 3 ints
array :fixed_length_array, :initial_length => 3 do
uint8
end
# This will read in each unit and pass it to the lambda until its value is 5
array :variable_length_array, :read_until => lambda { element != 5 } do
uint8
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment