Module: Meteoservice

Defined in:
lib/meteoservice.rb,
lib/meteoservice/error.rb,
lib/meteoservice/meteo.rb,
lib/meteoservice/predict.rb,
lib/meteoservice/version.rb,
lib/meteoservice/constants.rb,
lib/meteoservice/read_data.rb,
lib/meteoservice/parser_xml.rb,
lib/meteoservice/towns_data.rb,
lib/meteoservice/nested_hash_value.rb

Overview

Main Meteoservice module

Defined Under Namespace

Modules: Constants, NestedHashValue, ParserXml, TownsData Classes: Error, Meteo, Predict, ReadData

Constant Summary collapse

VERSION =
'0.2.7'

Class Method Summary collapse

Class Method Details

.result(city_index = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/meteoservice.rb', line 7

def self.result(city_index = nil)
  doc = if city_index
          Meteoservice::TownsData.auto_process(city_index.to_i)
        else
          Meteoservice::TownsData.process
        end

  puts "\e[H\e[2J"

  weather = Meteoservice::ReadData.from_array(doc[0]).to_a

  puts "#{doc[1]}\n\n"

  weather.each_with_index do |_day, index|
    puts Meteoservice::Predict.new(weather[index])
    puts
  end
end