class WWFinder::Building
Attributes
address[R]
id[R]
info[RW]
name[R]
url[R]
Public Class Methods
all()
click to toggle source
# File lib/ww_finder/building.rb, line 20 def self.all WWFinder::Scraper.scrape_buildings if @@all.empty? @@all end
new(name, address, url, city)
click to toggle source
# 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
Public Instance Methods
prepare_details()
click to toggle source
# File lib/ww_finder/building.rb, line 16 def prepare_details WWFinder::Scraper.scrape_building_details(self) if !info end
Private Instance Methods
save()
click to toggle source
# File lib/ww_finder/building.rb, line 26 def save @@all << self end
set_city(city)
click to toggle source
# File lib/ww_finder/building.rb, line 30 def set_city(city) @city = city city.buildings << self end
set_id()
click to toggle source
# File lib/ww_finder/building.rb, line 35 def set_id @id = @@all.count + 1 end