Class: Continent

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/continent.rb

Instance Method Summary collapse

Instance Method Details

#land_mass(unit = :square_kilometers) ⇒ Object

Returns the land mass for this continent expressed in unit that can be either :square_kilometers (the default) or :square_miles



32
33
34
35
36
37
38
39
40
# File 'app/models/continent.rb', line 32

def land_mass(unit = :square_kilometers)
  km2 = Worldwise::TOTAL_CONTINENT_LAND_MASS * (land_mass_percentage / 100)
  case unit
  when :square_miles
    km2 * 0.386102
  else
    km2
  end
end