Module: Zonebie
- Defined in:
- lib/zonebie/info.rb,
lib/zonebie/info/version.rb
Defined Under Namespace
Modules: Info
Class Method Summary collapse
Class Method Details
.load_from_wikipedia(zone) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/zonebie/info.rb', line 11 def load_from_wikipedia(zone) @request = Thread.new do begin download_summary(zone) rescue StandardError 'Request to wikipedia failed, please check your network connection and try again later' end end end |
.print_timezone_info ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zonebie/info.rb', line 21 def print_timezone_info if @request.nil? $stderr.puts '', 'Please set a timezone before printing the info' else if @request.alive? $stderr.puts '', 'Wikipedia download did not complete in time, please check your network connection and try again later' else $stdout.puts '', @request.join.value end end end |
.set_timezone_with_info ⇒ Object
6 7 8 9 |
# File 'lib/zonebie/info.rb', line 6 def set_timezone_with_info set_random_timezone load_from_wikipedia(::Time.zone.name) end |