Skip to content

Instantly share code, notes, and snippets.

Created December 1, 2014 18:54
Show Gist options
  • Save anonymous/5197cd83022678b9a517 to your computer and use it in GitHub Desktop.
Save anonymous/5197cd83022678b9a517 to your computer and use it in GitHub Desktop.
class Ticket
VENUES = ["Convention Center", "Fairgrounds", "Town Hall"]
attr_reader :venue, :date
attr_accessor :price
def initialize(venue, date)
if VENUES.include?(venue)
@venue = venue
else
raise ArgumentError, "Unknown venue #{venue}"
end
@date = date
end
end
puts "The venues are: #{Ticket::VENUES}"
# GENERATES ERROR: puts "The venues are: #{Ticket.VENUES}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment