Module: WeatherSage::CLI::Forecast

Defined in:
lib/weather-sage/cli/forecast.rb

Overview

Namespace containing data for forecast and hourly commands.

Constant Summary collapse

COLUMNS =

List of forecast CSV columns and properties.

{
  name: 'address',
  prop: nil,
  show: i{forecast hourly_forecast},
}, {
  name: 'name',
  prop: 'name',
  show: i{forecast},
}, {
  name: 'start_time',
  prop: 'startTime',
  show: i{hourly_forecast},
}, {
  name: 'end_time',
  prop: 'endTime',
  show: i{hourly_forecast},
}, {
  name: 'is_daytime',
  prop: 'isDaytime',
  show: [],
}, {
  name: 'temperature',
  prop: 'temperature',
  show: i{forecast hourly_forecast},
}, {
  name: 'temperature_unit',
  prop: 'temperatureUnit',
  show: i{forecast hourly_forecast},
}, {
  name: 'temperature_trend',
  prop: 'temperatureTrend',
  show: [],
}, {
  name: 'wind_speed',
  prop: 'windSpeed',
  show: i{forecast hourly_forecast},
}, {
  name: 'wind_direction',
  prop: 'windDirection',
  show: i{forecast hourly_forecast},
}, {
  name: 'icon',
  prop: 'icon',
  show: [],
}, {
  name: 'short_forecast',
  prop: 'shortForecast',
  show: i{forecast hourly_forecast},
}, {
  name: 'detailed_forecast',
  prop: 'detailedForecast',
  show: [],
}].freeze

Class Method Summary collapse

Class Method Details

.columns(forecast_method, mode) ⇒ Object

Get columns for given forecast method and mode.



65
66
67
68
69
# File 'lib/weather-sage/cli/forecast.rb', line 65

def self.columns(forecast_method, mode)
  COLUMNS.select { |col|
    (mode == :full) || col[:show].include?(forecast_method)
  }
end