Upgrade to Pro — share decks privately, control downloads, hide ads and more …

value_struct

J-_-L
November 03, 2012

 value_struct

5-min introduction to read-only structs in Ruby

J-_-L

November 03, 2012
Tweet

More Decks by J-_-L

Other Decks in Technology

Transcript

  1. 5/6 rbjl.net ValueStruct: Optional mixins • #dup takes a optional

    hash for setting new values • Value structs can be initialized with the exact amount of arguments • Automatically freeze new instances • #to_h for converting into a hash • If Ruby version below 2.0
  2. 6/6 rbjl.net ValueStruct: Resources • gem install value_struct • https://github.com/janlelis/value_struct

    • Other solutions • https://github.com/tcrayford/Values • https://github.com/iconara/immutable_struct • Twitter • @happycode • Contact • happycode.org / devolute.org