Class: Restaurant
- Inherits:
-
Object
- Object
- Restaurant
- Defined in:
- lib/worlds_best_restaurants/restaurant.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#best_dish ⇒ Object
Returns the value of attribute best_dish.
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#description ⇒ Object
Returns the value of attribute description.
-
#food_style ⇒ Object
Returns the value of attribute food_style.
-
#head_chef ⇒ Object
Returns the value of attribute head_chef.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#position ⇒ Object
Returns the value of attribute position.
-
#url ⇒ Object
Returns the value of attribute url.
-
#website_url ⇒ Object
Returns the value of attribute website_url.
Class Method Summary collapse
Instance Method Summary collapse
- #doc ⇒ Object
-
#initialize(name = nil, url = nil, location = nil, position = nil) ⇒ Restaurant
constructor
A new instance of Restaurant.
Constructor Details
#initialize(name = nil, url = nil, location = nil, position = nil) ⇒ Restaurant
Returns a new instance of Restaurant.
7 8 9 10 11 12 13 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 7 def initialize(name=nil, url=nil, location=nil, position=nil) @name = name @url = url @location = location @position = position @@all << self end |
Instance Attribute Details
#best_dish ⇒ Object
Returns the value of attribute best_dish.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def best_dish @best_dish end |
#contact ⇒ Object
Returns the value of attribute contact.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def contact @contact end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def description @description end |
#food_style ⇒ Object
Returns the value of attribute food_style.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def food_style @food_style end |
#head_chef ⇒ Object
Returns the value of attribute head_chef.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def head_chef @head_chef end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def name @name end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def position @position end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def url @url end |
#website_url ⇒ Object
Returns the value of attribute website_url.
3 4 5 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 3 def website_url @website_url end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 15 def self.all @@all end |
.find(id) ⇒ Object
19 20 21 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 19 def self.find(id) self.all[id-1] end |
Instance Method Details
#doc ⇒ Object
47 48 49 |
# File 'lib/worlds_best_restaurants/restaurant.rb', line 47 def doc @doc ||= Nokogiri::HTML(open(self.url)) end |