Module: OnTheSnow::Resort::Weather

Included in:
Resort
Defined in:
lib/onthesnow/resort/weather.rb

Instance Method Summary collapse

Instance Method Details

#conditionObject



25
26
27
# File 'lib/onthesnow/resort/weather.rb', line 25

def condition
  @condition ||= dom(:weather).search(".condition").text unless dom(:weather).empty?
end

#dateObject



9
10
11
# File 'lib/onthesnow/resort/weather.rb', line 9

def date
  @date ||= dom(:weather).search(".today p").first.text unless dom(:weather).empty?
end

#degreeObject



13
14
15
# File 'lib/onthesnow/resort/weather.rb', line 13

def degree
  @degree ||= dom(:weather).search(".temperature").first.text unless dom(:weather).empty?
end

#degree_in_cObject



21
22
23
# File 'lib/onthesnow/resort/weather.rb', line 21

def degree_in_c
  @degree_in_c ||= degree.split(" / ")[1] unless dom(:weather).empty?
end

#degree_in_fObject



17
18
19
# File 'lib/onthesnow/resort/weather.rb', line 17

def degree_in_f
  @degree_in_f ||= degree.split(" / ")[0] unless dom(:weather).empty?
end

#weatherObject



5
6
7
# File 'lib/onthesnow/resort/weather.rb', line 5

def weather
  @weather ||= {"date" => date, "temperature" => {"f" => degree_in_f, "c" => degree_in_c}, "condition" => condition} unless dom(:weather).empty?
end