Class: LocalRealEstate::Listing

Inherits:
Object
  • Object
show all
Defined in:
lib/local_real_estate/listing.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address: nil, city: nil, state: nil, url: nil, price: nil, bedrooms: nil, bathrooms: nil, sqft: nil, cars: "none", lot_size: nil) ⇒ Listing

Returns a new instance of Listing.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/local_real_estate/listing.rb', line 6

def initialize(address: nil, city: nil, state: nil, url: nil, price: nil, bedrooms: nil, bathrooms: nil, sqft: nil, cars: "none", lot_size: nil)
  @address = address
  @city = city
  @state = state
  @url = url
  @price = price
  @bedrooms = bedrooms
  @bathrooms = bathrooms
  @sqft = sqft
  @cars = cars
  @lot_size = lot_size
  @@all << self
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def address
  @address
end

#bathroomsObject

Returns the value of attribute bathrooms.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def bathrooms
  @bathrooms
end

#bedroomsObject

Returns the value of attribute bedrooms.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def bedrooms
  @bedrooms
end

#carsObject

Returns the value of attribute cars.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def cars
  @cars
end

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def city
  @city
end

#lot_sizeObject

Returns the value of attribute lot_size.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def lot_size
  @lot_size
end

#priceObject

Returns the value of attribute price.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def price
  @price
end

#sqftObject

Returns the value of attribute sqft.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def sqft
  @sqft
end

#stateObject

Returns the value of attribute state.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def state
  @state
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/local_real_estate/listing.rb', line 3

def url
  @url
end

Class Method Details

.allObject



20
21
22
# File 'lib/local_real_estate/listing.rb', line 20

def self.all
  @@all
end

.current_cityObject



24
25
26
# File 'lib/local_real_estate/listing.rb', line 24

def self.current_city
  @@all[0].city
end