Class: Attractions

Inherits:
Object
  • Object
show all
Defined in:
lib/undercover_tourist_cli/attractions.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, description = nil, rating = nil, current_crowd_rating = nil, priority_attractions = nil, hours = nil, url = nil, city = nil) ⇒ Attractions

Returns a new instance of Attractions.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/undercover_tourist_cli/attractions.rb', line 7

def initialize(name = nil, description = nil, rating = nil, current_crowd_rating = nil, priority_attractions = nil, hours = nil, url = nil, city = nil)
  @name = name
  @description = description
  @rating = rating
  @current_crowd_rating = current_crowd_rating
  @priority_attractions = []
  @hours = hours
  @city = city
  @url = url
  @@all << self
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def city
  @city
end

#current_crowd_ratingObject

Returns the value of attribute current_crowd_rating.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def current_crowd_rating
  @current_crowd_rating
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def description
  @description
end

#hoursObject

Returns the value of attribute hours.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def hours
  @hours
end

#listObject

Returns the value of attribute list.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def list
  @list
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def name
  @name
end

#priority_attractionsObject

Returns the value of attribute priority_attractions.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def priority_attractions
  @priority_attractions
end

#ratingObject

Returns the value of attribute rating.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def rating
  @rating
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/undercover_tourist_cli/attractions.rb', line 3

def url
  @url
end

Class Method Details

.allObject



19
20
21
# File 'lib/undercover_tourist_cli/attractions.rb', line 19

def self.all
  @@all 
end

.find_by_name(name) ⇒ Object



27
28
29
# File 'lib/undercover_tourist_cli/attractions.rb', line 27

def self.find_by_name(name)
  @@all.detect {|a| a.name == name}
end

Instance Method Details

#find_by_city(city) ⇒ Object



23
24
25
# File 'lib/undercover_tourist_cli/attractions.rb', line 23

def find_by_city(city)
  self.all.select {|a| a.city == city}
end