Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
worlddb-models gem - world.db schema & models for easy (re)use
Ruby
Branch: master
Failed to load latest commit information.
attic up names
lib/worlddb up tree reader
script country report
test country report
.gitignore add country report
HISTORY.md cleanup/polish models
Manifest.txt country report
README.md up readme
Rakefile up tree lookup
TODO.md up
worlddb-models-place.png up
worlddb-models.png add diagrams

README.md

worlddb-models

worlddb-models gem - world.db schema 'n' models for easy (re)use

Usage Models

Class Model Diagrams

Everything is a place.

Country Model - Example:

at = Country.find_by! key: 'at'
at.name
# => 'Austria'
at.pop
# => 8_414_638
at.area
# => 83_871

at.states.count
# => 9
at.states
# => [ 'Wien', 'Niederösterreich', 'Oberösterreich', ... ]

at.cities.by_pop
# => [ 'Wien', 'Graz', 'Linz', 'Salzburg', 'Innsbruck' ... ]

City Model - Example:

c = City.find_by! key: 'wien'
c.name
# => 'Wien'
c.country.name
# => 'Austria'
c.country.continent.name
# => 'Europe'

la = City.find_by! key: 'losangeles'
la.name
# => 'Los Angeles'
la.state.name
# => 'California'
la.state.key
# => 'ca'
la.country.name
# => 'United States'
la.country.key
# => 'us'
la.country.continent.name
# => 'North America'

Tag Model - Example:

euro = Tag.find_by! key: 'euro'
euro.countries.count
# => 17
euro.countries
# => ['Austria, 'Belgium', 'Cyprus', ... ]

flanders = Tag.find_by! key: 'flanders'
flanders.states.count
# => 5
flanders.states
# => ['Antwerpen', 'Brabant Wallon', 'Limburg', 'Oost-Vlaanderen', 'West-Vlaanderen']
flanders.states.first.country.name
# => 'Belgium'

and so on.

License

The worlddb-models scripts are dedicated to the public domain. Use it as you please with no restrictions whatsoever.

Questions? Comments?

Send them along to the Open Mundi (world.db) Database Forum/Mailing List. Thanks!

Something went wrong with that request. Please try again.