class Sunweather::Runner
Public Class Methods
new()
click to toggle source
# File lib/sunweather/runner.rb, line 7 def initialize @geo = (ARGV[0] ? Geo.new(ARGV[0]) : Geo.new) @data = Data.new(@geo.lat, @geo.lng) end
Public Instance Methods
cli_output()
click to toggle source
# File lib/sunweather/runner.rb, line 12 def cli_output "Dawn from #{hours_minutes(@data.start_of_dawn)} to #{hours_minutes(@data.sunrise)}.\nDusk from #{hours_minutes(@data.sunset)} to #{hours_minutes(@data.end_of_dusk)}.\nTemperature: #{@data.temperature}°C, feels like #{@data.feels_like}°C.\nWeather: #{@data.conditions}, Winds #{@data.wind_speed.downcase}, direction #{@data.wind_direction}.\n" end
hours_minutes(time)
click to toggle source
# File lib/sunweather/runner.rb, line 20 def hours_minutes time %-#{time.hour}:#{"%02i" % (time.min+time.sec/30)}- end
run_cli()
click to toggle source
# File lib/sunweather/runner.rb, line 16 def run_cli puts cli_output end