Class: WWFinder::Building
- Inherits:
-
Object
- Object
- WWFinder::Building
- Defined in:
- lib/ww_finder/building.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#info ⇒ Object
Returns the value of attribute info.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, address, url, city) ⇒ Building
constructor
A new instance of Building.
- #prepare_details ⇒ Object
Constructor Details
#initialize(name, address, url, city) ⇒ Building
Returns a new instance of Building.
7 8 9 10 11 12 13 14 |
# File 'lib/ww_finder/building.rb', line 7 def initialize(name, address, url, city) @name = name @address = address @url = url set_city(city) set_id save end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
2 3 4 |
# File 'lib/ww_finder/building.rb', line 2 def address @address end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/ww_finder/building.rb', line 2 def id @id end |
#info ⇒ Object
Returns the value of attribute info.
3 4 5 |
# File 'lib/ww_finder/building.rb', line 3 def info @info end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/ww_finder/building.rb', line 2 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
2 3 4 |
# File 'lib/ww_finder/building.rb', line 2 def url @url end |
Class Method Details
.all ⇒ Object
20 21 22 23 |
# File 'lib/ww_finder/building.rb', line 20 def self.all WWFinder::Scraper.scrape_buildings if @@all.empty? @@all end |
Instance Method Details
#prepare_details ⇒ Object
16 17 18 |
# File 'lib/ww_finder/building.rb', line 16 def prepare_details WWFinder::Scraper.scrape_building_details(self) if !info end |