Skip to content

Instantly share code, notes, and snippets.

@hackervera
Created August 3, 2016 15:20
Show Gist options
  • Save hackervera/5608b396835e569bcef8c4e2197bfb22 to your computer and use it in GitHub Desktop.
Save hackervera/5608b396835e569bcef8c4e2197bfb22 to your computer and use it in GitHub Desktop.
2.1.2 :001 > Person = Struct.new(:name, :age, :location) do
2.1.2 :002 > def timezone
2.1.2 :003?> "Person currently in whatever timezone contains #{location}"
2.1.2 :004?> end
2.1.2 :005?> end
=> Person
2.1.2 :006 > tyler = Person.new(:tyler, 32, :portland)
=> #<struct Person name=:tyler, age=32, location=:portland>
2.1.2 :007 > tyler.location
=> :portland
2.1.2 :008 > tyler.timezone
=> "Person currently in whatever timezone contains portland"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment