Sha256: a2221a9f8386239d03d2b6596913c04367ec572c7b3351e1405d69f554d9824c
Contents?: true
Size: 692 Bytes
Versions: 3
Compression:
Stored size: 692 Bytes
Contents
# frozen_string_literal: true module USGeo # This module is mixed into all models with a population and land area. module Population # @!attribute population # @return [Integer, nil] Total population of the area. # @!attribute housing_units # @return [Integer, nil] Total housing units in the area. # Population per square mile. # # @return [Float, nil] def population_density population.to_f / land_area if population && land_area.to_f > 0 end # Population per square kilometer. # # @return [Float, nil] def population_density_km population.to_f / land_area_km if population && land_area.to_f > 0 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
us_geo-2.0.2 | lib/us_geo/population.rb |
us_geo-2.0.1 | lib/us_geo/population.rb |
us_geo-2.0.0 | lib/us_geo/population.rb |