Created
January 14, 2016 10:32
-
-
Save krokrob/dcebcc6aa483af84f7c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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