Module: WorldDb
- Defined in:
- lib/worlddb/models/forward.rb,
lib/worlddb.rb,
lib/worlddb/stats.rb,
lib/worlddb/reader.rb,
lib/worlddb/schema.rb,
lib/worlddb/deleter.rb,
lib/worlddb/matcher.rb,
lib/worlddb/version.rb,
lib/worlddb/cli/opts.rb,
lib/worlddb/models/city.rb,
lib/worlddb/models/lang.rb,
lib/worlddb/models/name.rb,
lib/worlddb/models/place.rb,
lib/worlddb/models/usage.rb,
lib/worlddb/readers/base.rb,
lib/worlddb/readers/city.rb,
lib/worlddb/readers/lang.rb,
lib/worlddb/models/region.rb,
lib/worlddb/readers/usage.rb,
lib/worlddb/models/country.rb,
lib/worlddb/readers/region.rb,
lib/worlddb/readers/country.rb,
lib/worlddb/models/city_comp.rb,
lib/worlddb/models/continent.rb,
lib/worlddb/models/lang_comp.rb,
lib/worlddb/models/region_comp.rb,
lib/worlddb/models/country_comp.rb,
lib/worlddb/models/continent_comp.rb
Overview
forward references
require first to resolve circular references
Defined Under Namespace
Modules: Matcher, Model Classes: BaseReader, CityReader, CountryReader, CreateDb, Deleter, LangReader, Opts, Reader, RegionReader, Stats, UsageReader
Constant Summary collapse
- VERSION =
sync version w/ sport.db - why? why not?
'2.0.1'
- Models =
note: convenience alias for Model lets you use include WorldDb::Models
Model
Class Method Summary collapse
- .banner ⇒ Object
- .create ⇒ Object
-
.delete! ⇒ Object
delete ALL records (use with care!).
- .main ⇒ Object
- .props ⇒ Object
- .read(ary, include_path) ⇒ Object
-
.read_all(include_path, opts = {}) ⇒ Object
load all builtins (using plain text reader); helper for convenience.
- .read_setup(setup, include_path, opts = {}) ⇒ Object
- .root ⇒ Object
-
.stats ⇒ Object
todo: remove stats ??? why? why not? better use .tables.
- .tables ⇒ Object
Class Method Details
.banner ⇒ Object
68 69 70 |
# File 'lib/worlddb.rb', line 68 def self. "worlddb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]" end |
.create ⇒ Object
81 82 83 84 |
# File 'lib/worlddb.rb', line 81 def self.create CreateDb.new.up ConfDb::Model::Prop.create!( key: 'db.schema.world.version', value: VERSION ) end |
.delete! ⇒ Object
delete ALL records (use with care!)
106 107 108 109 |
# File 'lib/worlddb.rb', line 106 def self.delete! puts '*** deleting world table records/data...' Deleter.new.run end |
.main ⇒ Object
76 77 78 79 |
# File 'lib/worlddb.rb', line 76 def self.main require 'worlddb/cli/main' ## Runner.new.run(ARGV) - old code end |
.props ⇒ Object
123 124 125 126 |
# File 'lib/worlddb.rb', line 123 def self.props ### fix: use ConfDb.props delegate or similar !!! Stats.new.props end |
.read(ary, include_path) ⇒ Object
87 88 89 90 91 92 |
# File 'lib/worlddb.rb', line 87 def self.read( ary, include_path ) reader = Reader.new( include_path ) ary.each do |name| reader.load( name ) end end |
.read_all(include_path, opts = {}) ⇒ Object
load all builtins (using plain text reader); helper for convenience
100 101 102 |
# File 'lib/worlddb.rb', line 100 def self.read_all( include_path, opts={} ) # load all builtins (using plain text reader); helper for convenience read_setup( 'setups/all', include_path, opts ) end |
.read_setup(setup, include_path, opts = {}) ⇒ Object
95 96 97 98 |
# File 'lib/worlddb.rb', line 95 def self.read_setup( setup, include_path, opts={} ) reader = Reader.new( include_path, opts ) reader.load_setup( setup ) end |
.root ⇒ Object
72 73 74 |
# File 'lib/worlddb.rb', line 72 def self.root "#{File.( File.dirname(File.dirname(__FILE__)) )}" end |
.stats ⇒ Object
todo: remove stats ??? why? why not? better use .tables
113 114 115 116 117 |
# File 'lib/worlddb.rb', line 113 def self.stats stats = Stats.new stats.tables ### stats.props end |