Class: WorldDb::Reader

Inherits:
ReaderBase show all
Defined in:
lib/worlddb/reader_file.rb

Instance Method Summary collapse

Methods inherited from ReaderBase

#load, #load_codes, #load_continent_defs, #load_continent_refs, #load_setup, #load_states_xxx, #skip_tags?, #strict?

Methods included from TextUtils::ValueHelper

#is_state?, #match_city, #match_country, #match_metro, #match_metro_flag, #match_metro_pop, #match_state_for_country, #match_supra, #match_supra_flag

Methods included from Matcher

#match_adm2_counties_for_country, #match_adm2_parts_for_country, #match_adm3_counties_for_country, #match_cities_for_country, #match_countries_for_continent, #match_states_abbr_for_country, #match_states_for_country, #match_states_iso_for_country, #match_states_nuts_for_country, #match_tree_for_country

Constructor Details

#initialize(include_path, opts = {}) ⇒ Reader

Returns a new instance of Reader.



7
8
9
10
11
# File 'lib/worlddb/reader_file.rb', line 7

def initialize( include_path, opts={} )
  super( opts )

  @include_path = include_path
end

Instance Method Details

#create_city_reader(name, more_attribs = {}) ⇒ Object



84
85
86
87
88
89
# File 'lib/worlddb/reader_file.rb', line 84

def create_city_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"
  logger.info "parsing data (city) '#{name}' (#{path})..."

  CityReader.from_file( path, more_attribs )
end

#create_country_reader(name, more_attribs = {}) ⇒ Object



36
37
38
39
40
41
# File 'lib/worlddb/reader_file.rb', line 36

def create_country_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"
  logger.info "parsing data (country) '#{name}' (#{path})..."

  CountryReader.from_file( path, more_attribs )
end

#create_county_reader(name, more_attribs = {}) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/worlddb/reader_file.rb', line 59

def create_county_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"

  logger.info "parsing data (county) '#{name}' (#{path})..."

  CountyReader.from_file( path, more_attribs )
end

#create_fixture_reader(name) ⇒ Object



14
15
16
17
18
19
# File 'lib/worlddb/reader_file.rb', line 14

def create_fixture_reader( name )
  path = "#{@include_path}/#{name}.txt"
  logger.info "parsing data (setup) '#{name}' (#{path})..."

  FixtureReader.from_file( path )
end

#create_hash_reader(name) ⇒ Object



92
93
94
95
96
97
# File 'lib/worlddb/reader_file.rb', line 92

def create_hash_reader( name )
  path = "#{@include_path}/#{path_to_real_path(name)}.yml"
  logger.info "parsing data (hash) '#{name}' (#{path})..."

  HashReader.from_file( path )
end

#create_lang_reader(name) ⇒ Object



21
22
23
24
25
26
# File 'lib/worlddb/reader_file.rb', line 21

def create_lang_reader( name )
  path = "#{@include_path}/#{path_to_real_path(name)}.yml"   ## hash reader - use .yml??    
  logger.info "parsing data (lang) '#{name}' (#{path})..."

  LangReader.from_file( path )
end

#create_line_reader(name) ⇒ Object



106
107
108
109
110
111
# File 'lib/worlddb/reader_file.rb', line 106

def create_line_reader( name )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"
  logger.info "parsing data (line) '#{name}' (#{path})..."

  LineReader.from_file( path )
end

#create_muni_reader(name, more_attribs = {}) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/worlddb/reader_file.rb', line 67

def create_muni_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"

  logger.info "parsing data (muni) '#{name}' (#{path})..."

  MuniReader.from_file( path, more_attribs )
end

#create_part_reader(name, more_attribs = {}) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/worlddb/reader_file.rb', line 51

def create_part_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"

  logger.info "parsing data (part) '#{name}' (#{path})..."

  PartReader.from_file( path, more_attribs )
end

#create_state_reader(name, more_attribs = {}) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/worlddb/reader_file.rb', line 43

def create_state_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"

  logger.info "parsing data (state) '#{name}' (#{path})..."

  StateReader.from_file( path, more_attribs )
end

#create_tree_reader(name, more_attribs = {}) ⇒ Object



76
77
78
79
80
81
# File 'lib/worlddb/reader_file.rb', line 76

def create_tree_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"
  logger.info "parsing data (state tree) '#{name}' (#{path})..."

  StateTreeReader.from_file( path, more_attribs )
end

#create_usage_reader(name) ⇒ Object



28
29
30
31
32
33
# File 'lib/worlddb/reader_file.rb', line 28

def create_usage_reader( name )
  path = "#{@include_path}/#{path_to_real_path(name)}.yml"   ## hash reader - use .yml??
  logger.info "parsing data (usage) '#{name}' (#{path})..."

  UsageReader.from_file( path )
end

#create_values_reader(name, more_attribs = {}) ⇒ Object



99
100
101
102
103
104
# File 'lib/worlddb/reader_file.rb', line 99

def create_values_reader( name, more_attribs={} )
  path = "#{@include_path}/#{path_to_real_path(name)}.txt"
  logger.info "parsing data (values) '#{name}' (#{path})..."

  ValuesReader.from_file( path, more_attribs )
end