Module: FreeZipcodeData

Defined in:
lib/free_zipcode_data.rb,
lib/free_zipcode_data/logger.rb,
lib/free_zipcode_data/runner.rb,
lib/free_zipcode_data/options.rb,
lib/free_zipcode_data/version.rb,
lib/free_zipcode_data/db_table.rb,
lib/free_zipcode_data/data_source.rb,
lib/free_zipcode_data/state_table.rb,
lib/free_zipcode_data/county_table.rb,
lib/free_zipcode_data/country_table.rb,
lib/free_zipcode_data/zipcode_table.rb

Defined Under Namespace

Classes: CountryTable, CountyTable, DataSource, DbTable, Logger, Options, Runner, StateTable, ZipcodeTable

Constant Summary collapse

VERSION =
'1.0.2'.freeze

Class Method Summary collapse

Class Method Details

.config_file(filename = '.free_zipcode_data.yml') ⇒ Object

:nocov:



17
18
19
20
21
22
23
# File 'lib/free_zipcode_data.rb', line 17

def self.config_file(filename = '.free_zipcode_data.yml')
  return root.join('spec', 'fixtures', filename) if current_environment == 'test'
  home = ENV.fetch('HOME')
  file = ENV.fetch('FZD_CONFIG_FILE', File.join(home, '.free_zipcode_data.yml'))
  FileUtils.touch(file)
  file
end

.current_environmentObject



12
13
14
# File 'lib/free_zipcode_data.rb', line 12

def self.current_environment
  ENV.fetch('APP_ENV', 'development')
end

.osObject

:nocov:



26
27
28
29
30
31
32
# File 'lib/free_zipcode_data.rb', line 26

def self.os
  if RUBY_PLATFORM.match?(/cygwin|mswin|mingw|bccwin|wince|emx/)
    :retarded
  else
    :normal
  end
end

.rootObject



8
9
10
# File 'lib/free_zipcode_data.rb', line 8

def self.root
  Pathname.new(File.dirname(__FILE__)).parent
end