class ElTiempoCLI
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/eltiempobcn.rb, line 68 def self.exit_on_failure? true end
start( args )
click to toggle source
Calls superclass method
# File lib/eltiempobcn.rb, line 56 def self.start( args ) if @@places clean_args = args clean_args[ 0 ] = args[ 0 ].sub( /^-*/, "" ) unless clean_args[ 0 ].nil? # remove the leading dashes before execuing the start method super( clean_args ) else puts "Couldn't connect with the server, please check your connection and try again later" end end
Public Instance Methods
av_max( place_name )
click to toggle source
# File lib/eltiempobcn.rb, line 25 def av_max( place_name ) place = Place.set_temperatures( place_name.to_s, @@places ) if place.kind_of?( Place ) puts "The average temperature for the Maximums this week in #{ place.name } are: #{ place.max_avg } celsius degrees" else puts "Couldn't find the city #{ place_name } or its data." end end
av_min( place_name )
click to toggle source
# File lib/eltiempobcn.rb, line 37 def av_min( place_name ) place = Place.set_temperatures( place_name.to_s, @@places ) if place.kind_of?( Place ) puts "The average temperature for the minimuims this week in #{ place.name } are: #{ place.min_avg } celsius degrees" else puts "Couldn't find the city #{ place_name } or its data." end end
list()
click to toggle source
# File lib/eltiempobcn.rb, line 49 def list puts @@places_names.join( " | " ) end
today( place_name )
click to toggle source
# File lib/eltiempobcn.rb, line 13 def today( place_name ) place = Place.set_temperatures( place_name.to_s, @@places ) if place.kind_of?( Place ) puts "Today's temperatures for #{ place.name } are: [ min: #{ place.min_today }, max: #{ place.max_today } ] celsius" else puts "Couldn't find the city #{ place_name } or its data." end end