Random Ruby Tricks: Struct.new – Literate Programming
Sep 3, 2012
Neat trick about using Ruby Struct for simple domain concepts:
Point = Struct.new(:x, :y) origin = Point(0,0)
Struct.new returns a class, which we assign to the Point constant. Very cool. We just created a simple class with constructor and two accessors (x and y).
Link: Random Ruby Tricks: Struct.new – Literate Programming via blog.steveklabnik.com