Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created July 26, 2014 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/267d6ed5ab5a31e9f94b to your computer and use it in GitHub Desktop.
Save havenwood/267d6ed5ab5a31e9f94b to your computer and use it in GitHub Desktop.
Point Equalizer Struct
require 'equalizer'
Point = Struct.new(:x, :y) { include Equalizer.new(*members) }
Point.new(0, 0)
#=> #<struct Point x=0, y=0>
Point.new(0, 0) == Point.new(0, 0)
#=> true
Point.new(0, 0) == Point.new(1, 1)
#=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment