Class: Weatherboy::Forecast

Inherits:
Object
  • Object
show all
Defined in:
lib/weatherboy/forecast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def conditions
  @conditions
end

#high_cObject (readonly)

Returns the value of attribute high_c.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def high_c
  @high_c
end

#high_fObject (readonly)

Returns the value of attribute high_f.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def high_f
  @high_f
end

#iconObject (readonly)

Returns the value of attribute icon.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def icon
  @icon
end

#low_cObject (readonly)

Returns the value of attribute low_c.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def low_c
  @low_c
end

#low_fObject (readonly)

Returns the value of attribute low_f.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def low_f
  @low_f
end

#popObject (readonly)

Returns the value of attribute pop.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def pop
  @pop
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def text
  @text
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/weatherboy/forecast.rb', line 4

def title
  @title
end

Instance Method Details

#first_pass(doc) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/weatherboy/forecast.rb', line 6

def first_pass(doc)
  @high_f = doc.elements['high/fahrenheit'].text
  @high_c = doc.elements['high/celsius'].text
  @low_f = doc.elements['low/fahrenheit'].text
  @low_c = doc.elements['low/celsius'].text
  @conditions = doc.elements['conditions'].text
  @icon = "http://icons-ecast.wxug.com/graphics/conds/#{doc.elements['icon'].text}.gif"
  @pop = doc.elements['pop'].text
end

#second_pass(doc) ⇒ Object



16
17
18
19
# File 'lib/weatherboy/forecast.rb', line 16

def second_pass(doc)
  @title = doc.elements['title'].text
  @text = doc.elements['fcttext'].text
end