#!/usr/bin/env ruby -Ku begin require "weatherhacks" rescue LoadError require "rubygems" require "weatherhacks" end require "optparse" OptionParser.new do |opt| opt.on("--list") do $mode = :list end opt.parse! end def temperature(forecast) line = [] if forecast.celsius.min line << "最低気温" + forecast.celsius.min.to_s + "度" end if forecast.celsius.max line << "最高気温" + forecast.celsius.max.to_s + "度" end "(" + line.join(", ") + ")" end def show_forecast today = WeatherHacks::LWWS.request($city.id, :today) tomorrow = WeatherHacks::LWWS.request($city.id, :tomorrow) dayaftertomorrow = WeatherHacks::LWWS.request($city.id, :dayaftertomorrow) puts <