Class: Eatable::Restaurant
- Inherits:
-
Object
- Object
- Eatable::Restaurant
- Defined in:
- lib/eatable/restaurant.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#menu ⇒ Object
Returns the value of attribute menu.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#website ⇒ Object
Returns the value of attribute website.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ Restaurant
constructor
A new instance of Restaurant.
Constructor Details
#initialize(hash) ⇒ Restaurant
Returns a new instance of Restaurant.
7 8 9 10 |
# File 'lib/eatable/restaurant.rb', line 7 def initialize(hash) hash.each {|k, v| self.send('#{k}=', v)} @@all << self end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/eatable/restaurant.rb', line 5 def address @address end |
#menu ⇒ Object
Returns the value of attribute menu.
5 6 7 |
# File 'lib/eatable/restaurant.rb', line 5 def @menu end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/eatable/restaurant.rb', line 5 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
5 6 7 |
# File 'lib/eatable/restaurant.rb', line 5 def phone @phone end |
#website ⇒ Object
Returns the value of attribute website.
5 6 7 |
# File 'lib/eatable/restaurant.rb', line 5 def website @website end |
Class Method Details
.all ⇒ Object
12 13 14 |
# File 'lib/eatable/restaurant.rb', line 12 def self.all @@all end |
.reset ⇒ Object
16 17 18 |
# File 'lib/eatable/restaurant.rb', line 16 def self.reset self.class.all.clear end |