Class: Eatable::Restaurant

Inherits:
Object
  • Object
show all
Defined in:
lib/eatable/restaurant.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#addressObject

Returns the value of attribute address.



5
6
7
# File 'lib/eatable/restaurant.rb', line 5

def address
  @address
end

Returns the value of attribute menu.



5
6
7
# File 'lib/eatable/restaurant.rb', line 5

def menu
  @menu
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/eatable/restaurant.rb', line 5

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



5
6
7
# File 'lib/eatable/restaurant.rb', line 5

def phone
  @phone
end

#websiteObject

Returns the value of attribute website.



5
6
7
# File 'lib/eatable/restaurant.rb', line 5

def website
  @website
end

Class Method Details

.allObject



12
13
14
# File 'lib/eatable/restaurant.rb', line 12

def self.all
  @@all
end

.resetObject



16
17
18
# File 'lib/eatable/restaurant.rb', line 16

def self.reset
  self.class.all.clear
end