Sha256: e50d237e83fb3b9bcfb6ccf7bdc5c7bad420d517595e9fc5f82725c1e434f673
Contents?: true
Size: 762 Bytes
Versions: 2
Compression:
Stored size: 762 Bytes
Contents
require "thor" require 'json' require 'meteo' require 'meteo/reporter' class MeteoCLI < Thor include Reporter desc "quote location", "quote weather for location" long_desc <<-LONGDESC `meteo` will print weather quote for requested city. You can optionally specify a second parameter, which will print out a from message as well. > $ meteo Plainsboro, NJ > $ meteo Moscow, RU --units=metric LONGDESC option :units, :aliases => "-u" def quote(location) units = options[:units] ? options[:units] : "imperial" service = Meteo.new response = JSON.parse(service.quote(location, units)) if response["message"] puts response["message"] else puts report(response, units).join(' ') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
meteo-1.0.2 | lib/meteo/meteo_cli.rb |
meteo-1.0.1 | lib/meteo/meteo_cli.rb |