geo2tz 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/geo2tz.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "geo2tz/version"
2
2
  require "geo2tz/configuration"
3
- require 'geo2tz/data_fetcher'
3
+ require 'geo2tz/updater'
4
4
  require 'geo2tz/search'
5
5
  require 'geo2tz/railtie' if defined?(Rails)
6
6
  module Geo2tz
data/lib/geo2tz/search.rb CHANGED
@@ -14,7 +14,7 @@ module Geo2tz
14
14
 
15
15
  def self.setup_tree
16
16
  points = []
17
- File.open("#{Geo2tz.config[:writable_directory]}/#{Geo2tz.config[:filename]}").each do |line|
17
+ File.open(File.join(Geo2tz.config[:writable_directory],Geo2tz.config[:filename])).each do |line|
18
18
  data = line.split(',')
19
19
  tz = data[2].strip
20
20
  unless MAP.has_key? tz
@@ -29,15 +29,17 @@ module Geo2tz
29
29
  line_data = line.split("\t")
30
30
  @parsed_cities << {:lat => line_data[4], :long => line_data[5], :tz => line_data[17]}
31
31
  end
32
+ @unparsed_cities = nil # dont need it anymore, let's free up some memory
32
33
  true
33
34
  end
34
35
 
35
36
  def write_file
36
- File.open("#{Geo2tz.config[:writable_directory]}/#{Geo2tz.config[:filename]}", 'w') do |file|
37
+ File.open(File.join(Geo2tz.config[:writable_directory],Geo2tz.config[:filename]), 'w') do |file|
37
38
  @parsed_cities.each do |city|
38
39
  file.write("#{city[:lat]},#{city[:long]},#{city[:tz]}\n")
39
40
  end
40
41
  end
42
+ @parsed_cities = nil# dont need it anymore, let's free up some memory
41
43
  true
42
44
  end
43
45
 
@@ -1,3 +1,3 @@
1
1
  module Geo2tz
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo2tz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: