class WeatherCard::Hourly
Attributes
day[RW]
|dayTime | |temp feels | |shortdetail| |xx wind | |h:xxx p:xxx|
Public Class Methods
all()
click to toggle source
# File lib/weathercard.rb, line 274 def self.all @@all end
display()
click to toggle source
# File lib/weathercard.rb, line 328 def self.display beginning = 0 final = 5 n = (self.length / 6.0 + 0.5).to_i n.times do row1 = '' row2 = '' row3 = '' row4 = '' row5 = '' row6 = '' row7 = '' row8 = '' self.all[beginning..final].each do |weather| row1 += weather.line1 row2 += weather.line2 row3 += weather.line3 row4 += weather.line4 row5 += weather.line5 row6 += weather.line6 row7 += weather.line7 row8 += weather.line8 end beginning += 6 final += 6 puts row1 puts row2 puts row3 puts row4 puts row5 puts row6 puts row7 puts row8 end end
horizontal()
click to toggle source
# File lib/weathercard.rb, line 266 def self.horizontal @@horizontal end
length()
click to toggle source
# File lib/weathercard.rb, line 262 def self.length @@length end
vertical()
click to toggle source
# File lib/weathercard.rb, line 270 def self.vertical @@vertical end
Public Instance Methods
line1()
click to toggle source
# File lib/weathercard.rb, line 278 def line1 line_end end
line2()
click to toggle source
# File lib/weathercard.rb, line 282 def line2 str_length = day.day.length spaces = return_spaces(str_length) str = "#{day.day.colorize(:light_green)}#{spaces}" line_intermediate(str) end
line3()
click to toggle source
# File lib/weathercard.rb, line 289 def line3 str_length = day.current_temp.length + 6 spaces = return_spaces(str_length) str = "curr: #{day.current_temp}#{spaces}" line_intermediate(str) end
line4()
click to toggle source
# File lib/weathercard.rb, line 296 def line4 str_length = day.feels_like.length + 7 spaces = return_spaces(str_length) str = "feels: #{day.feels_like}#{spaces}" line_intermediate(str) end
line5()
click to toggle source
# File lib/weathercard.rb, line 303 def line5 str_length = [day.short_detail.length, 11].min spaces = return_spaces(str_length) str = "#{day.short_detail[0..10]}#{spaces}" line_intermediate(str) end
line6()
click to toggle source
# File lib/weathercard.rb, line 310 def line6 str_length = day.wind_magnitude.length spaces = return_spaces(str_length) str = "#{day.wind_magnitude}#{spaces}" line_intermediate(str) end
line7()
click to toggle source
# File lib/weathercard.rb, line 317 def line7 str_length = day.humidity.length + day.precipitation.length + 4 spaces = return_spaces(str_length) str = "h:#{day.humidity}#{spaces}p:#{day.precipitation}" line_intermediate(str) end
line8()
click to toggle source
# File lib/weathercard.rb, line 324 def line8 line1 end