Class: Attractions
- Inherits:
-
Object
- Object
- Attractions
- Defined in:
- lib/undercover_tourist_cli/attractions.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#current_crowd_rating ⇒ Object
Returns the value of attribute current_crowd_rating.
-
#description ⇒ Object
Returns the value of attribute description.
-
#hours ⇒ Object
Returns the value of attribute hours.
-
#list ⇒ Object
Returns the value of attribute list.
-
#name ⇒ Object
Returns the value of attribute name.
-
#priority_attractions ⇒ Object
Returns the value of attribute priority_attractions.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #find_by_city(city) ⇒ Object
-
#initialize(name = nil, description = nil, rating = nil, current_crowd_rating = nil, priority_attractions = nil, hours = nil, url = nil, city = nil) ⇒ Attractions
constructor
A new instance of Attractions.
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, = nil, = nil, priority_attractions = nil, hours = nil, url = nil, city = nil) @name = name @description = description @rating = @current_crowd_rating = @priority_attractions = [] @hours = hours @city = city @url = url @@all << self end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def city @city end |
#current_crowd_rating ⇒ Object
Returns the value of attribute current_crowd_rating.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def @current_crowd_rating end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def description @description end |
#hours ⇒ Object
Returns the value of attribute hours.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def hours @hours end |
#list ⇒ Object
Returns the value of attribute list.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def list @list end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def name @name end |
#priority_attractions ⇒ Object
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 |
#rating ⇒ Object
Returns the value of attribute rating.
3 4 5 |
# File 'lib/undercover_tourist_cli/attractions.rb', line 3 def @rating end |
#url ⇒ Object
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
.all ⇒ Object
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 |