Skip to content

Instantly share code, notes, and snippets.

@krokrob
Created January 14, 2016 10:32
Show Gist options
  • Select an option

  • Save krokrob/dcebcc6aa483af84f7c3 to your computer and use it in GitHub Desktop.

Select an option

Save krokrob/dcebcc6aa483af84f7c3 to your computer and use it in GitHub Desktop.
class Restaurant
attr_reader :name
def initialize(name, city)
@name, @city = name, city
end
def self.categories
return %w(fast-food gastronomic traditional)
end
def self.prices
return ["fast-food: 10€", "gastronomic: 50€", "traditional: 25€"]
end
def to_s
return "Welcome to #{@name}, in #{@city}"
end
end
# puts Time.now
# require "json"
# puts JSON.parse('{"key1": "value1", "key2": "value2"}')
# puts Restaurant.categories
# resto = Restaurant.new("l'alicheur", "Paris")
# puts resto.categories
puts Restaurant.prices
# => fast-food: 10€
# => gastronomic: 50€
# => traditional: 25€
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment