Class: WeatherSage::CLI::Commands::StationsCommand
- Defined in:
- lib/weather-sage/cli/commands/stations.rb
Overview
Implementation of stations command.
Constant Summary collapse
- HELP =
Help for this command.
Used by the help command.
{ line: ' List weather stations near address. '.strip, full: [ 'List weather stations near address.', ].join("\n") }.freeze
- COL_NAMES =
CSV column names.
%w{ address station_id station_name x y elevation time_zone }.freeze
Instance Method Summary collapse
-
#run(args) ⇒ Object
Run stations command.
Methods inherited from Command
Constructor Details
This class inherits a constructor from WeatherSage::CLI::Commands::Command
Instance Method Details
#run(args) ⇒ Object
Run stations command.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/weather-sage/cli/commands/stations.rb', line 39 def run(args) CSV(STDOUT) do |csv| # write column names csv << COL_NAMES args.each do |arg| # geocode argument, get first point if pt = geocode(arg).first # walk stations pt.point.stations.each do |s| csv << make_row(arg, s) end end end end end |