Sha256: 4d2ed13d5ee6bb3c5db5a5a9fb86b098a594a958ac9d9a4d7b19ac3b8fc4cb95

Contents?: true

Size: 404 Bytes

Versions: 4

Compression:

Stored size: 404 Bytes

Contents

require 'timezone'

# Simple script to validate that lookups are threadsafe.
#
# Usage: bundle exec ruby -Ilib test/threadsafe_lookup.rb USERNAME

raise 'You must specify a geonames username' unless ARGV.first

Timezone::Lookup.config(:geonames) do |c|
  c.username = ARGV.first
end

threads = Array.new(5).map do
  Thread.new { p Timezone.lookup(33.7489954, -84.3879824).name }
end

threads.map(&:join)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
timezone-1.2.8 test/threadsafe_lookup.rb
timezone-1.2.7 test/threadsafe_lookup.rb
timezone-1.2.6 test/threadsafe_lookup.rb
timezone-1.2.5 test/threadsafe_lookup.rb