lib/us_geo/population.rb in us_geo-2.0.2 vs lib/us_geo/population.rb in us_geo-2.0.3
- old
+ new
@@ -20,7 +20,21 @@
#
# @return [Float, nil]
def population_density_km
population.to_f / land_area_km if population && land_area.to_f > 0
end
+
+ # Housing units per square mile.
+ #
+ # @return [Float, nil]
+ def housing_density
+ housing_units.to_f / land_area if housing_units && land_area.to_f > 0
+ end
+
+ # Housing units per square kilometer.
+ #
+ # @return [Float, nil]
+ def housing_density_km
+ housing_units.to_f / land_area_km if housing_units && land_area.to_f > 0
+ end
end
end