Class: Restaurant
- Inherits:
-
Object
- Object
- Restaurant
- Defined in:
- lib/restaurant.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#cross_streets ⇒ Object
Returns the value of attribute cross_streets.
-
#display_address ⇒ Object
Returns the value of attribute display_address.
-
#display_phone ⇒ Object
Returns the value of attribute display_phone.
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#eat24_url ⇒ Object
Returns the value of attribute eat24_url.
-
#id ⇒ Object
Returns the value of attribute id.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#is_claimed ⇒ Object
Returns the value of attribute is_claimed.
-
#is_closed ⇒ Object
Returns the value of attribute is_closed.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#menu_date_updated ⇒ Object
Returns the value of attribute menu_date_updated.
-
#menu_provider ⇒ Object
Returns the value of attribute menu_provider.
-
#mobile_url ⇒ Object
Returns the value of attribute mobile_url.
-
#name ⇒ Object
Returns the value of attribute name.
-
#neighborhoods ⇒ Object
Returns the value of attribute neighborhoods.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#rating_img_url ⇒ Object
Returns the value of attribute rating_img_url.
-
#rating_img_url_large ⇒ Object
Returns the value of attribute rating_img_url_large.
-
#rating_img_url_small ⇒ Object
Returns the value of attribute rating_img_url_small.
-
#reservation_url ⇒ Object
Returns the value of attribute reservation_url.
-
#review_count ⇒ Object
Returns the value of attribute review_count.
-
#snippet_image_url ⇒ Object
Returns the value of attribute snippet_image_url.
-
#snippet_text ⇒ Object
Returns the value of attribute snippet_text.
-
#state_code ⇒ Object
Returns the value of attribute state_code.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(restaurant) ⇒ Restaurant
constructor
A new instance of Restaurant.
Constructor Details
#initialize(restaurant) ⇒ Restaurant
Returns a new instance of Restaurant.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/restaurant.rb', line 6 def initialize(restaurant) location = restaurant.location coordinate = location.coordinate [restaurant, location, coordinate].each do |instance| instance.instance_variables.each do |variable| instance_has = instance.instance_variable_defined?(variable) self_has = self.instance_variables.find(variable) if instance_has && self_has if variable.to_s == "@categories" categories = instance.categories .map {|category| Category.find_by_title(category[0])} .compact @categories = categories categories.each {|category| category.restaurants << self} else self.instance_variable_set(variable, instance.instance_variable_get(variable)) end end end end @@all << self end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def address @address end |
#categories ⇒ Object
Returns the value of attribute categories.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def categories @categories end |
#city ⇒ Object
Returns the value of attribute city.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def city @city end |
#country_code ⇒ Object
Returns the value of attribute country_code.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def country_code @country_code end |
#cross_streets ⇒ Object
Returns the value of attribute cross_streets.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def cross_streets @cross_streets end |
#display_address ⇒ Object
Returns the value of attribute display_address.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def display_address @display_address end |
#display_phone ⇒ Object
Returns the value of attribute display_phone.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def display_phone @display_phone end |
#distance ⇒ Object
Returns the value of attribute distance.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def distance @distance end |
#eat24_url ⇒ Object
Returns the value of attribute eat24_url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def eat24_url @eat24_url end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def id @id end |
#image_url ⇒ Object
Returns the value of attribute image_url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def image_url @image_url end |
#is_claimed ⇒ Object
Returns the value of attribute is_claimed.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def is_claimed @is_claimed end |
#is_closed ⇒ Object
Returns the value of attribute is_closed.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def is_closed @is_closed end |
#latitude ⇒ Object
Returns the value of attribute latitude.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def longitude @longitude end |
#menu_date_updated ⇒ Object
Returns the value of attribute menu_date_updated.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def @menu_date_updated end |
#menu_provider ⇒ Object
Returns the value of attribute menu_provider.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def @menu_provider end |
#mobile_url ⇒ Object
Returns the value of attribute mobile_url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def mobile_url @mobile_url end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def name @name end |
#neighborhoods ⇒ Object
Returns the value of attribute neighborhoods.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def neighborhoods @neighborhoods end |
#phone ⇒ Object
Returns the value of attribute phone.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def phone @phone end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def postal_code @postal_code end |
#rating ⇒ Object
Returns the value of attribute rating.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def @rating end |
#rating_img_url ⇒ Object
Returns the value of attribute rating_img_url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def @rating_img_url end |
#rating_img_url_large ⇒ Object
Returns the value of attribute rating_img_url_large.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def @rating_img_url_large end |
#rating_img_url_small ⇒ Object
Returns the value of attribute rating_img_url_small.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def @rating_img_url_small end |
#reservation_url ⇒ Object
Returns the value of attribute reservation_url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def reservation_url @reservation_url end |
#review_count ⇒ Object
Returns the value of attribute review_count.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def review_count @review_count end |
#snippet_image_url ⇒ Object
Returns the value of attribute snippet_image_url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def snippet_image_url @snippet_image_url end |
#snippet_text ⇒ Object
Returns the value of attribute snippet_text.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def snippet_text @snippet_text end |
#state_code ⇒ Object
Returns the value of attribute state_code.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def state_code @state_code end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/restaurant.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
29 30 31 |
# File 'lib/restaurant.rb', line 29 def self.all @@all end |