Class: WWFinder::City
- Inherits:
-
Object
- Object
- WWFinder::City
- Defined in:
- lib/ww_finder/city.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#buildings ⇒ Object
readonly
Returns the value of attribute buildings.
-
#country ⇒ Object
Returns the value of attribute country.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #get_buildings ⇒ Object
-
#initialize(name, url, country) ⇒ City
constructor
A new instance of City.
Constructor Details
#initialize(name, url, country) ⇒ City
Returns a new instance of City.
7 8 9 10 11 12 13 |
# File 'lib/ww_finder/city.rb', line 7 def initialize(name, url, country) @name = name @url = url @buildings = [] set_country(country) save end |
Instance Attribute Details
#buildings ⇒ Object (readonly)
Returns the value of attribute buildings.
3 4 5 |
# File 'lib/ww_finder/city.rb', line 3 def buildings @buildings end |
#country ⇒ Object
Returns the value of attribute country.
2 3 4 |
# File 'lib/ww_finder/city.rb', line 2 def country @country end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/ww_finder/city.rb', line 2 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/ww_finder/city.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
19 20 21 22 |
# File 'lib/ww_finder/city.rb', line 19 def self.all WWFinder::Scraper.scrape_cities if @@all.empty? @@all end |
.find(input) ⇒ Object
24 25 26 |
# File 'lib/ww_finder/city.rb', line 24 def self.find(input) all[input] end |
Instance Method Details
#get_buildings ⇒ Object
15 16 17 |
# File 'lib/ww_finder/city.rb', line 15 def get_buildings WWFinder::Scraper.scrape_buildings_for(self) if buildings.empty? end |