Class: WeatherFunds::ResultSet
- Inherits:
-
Object
- Object
- WeatherFunds::ResultSet
- Defined in:
- lib/weather_funds/result_set.rb
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
- #date ⇒ Object
- #find(name) ⇒ Object
- #find_by_scheme(scheme) ⇒ Object
-
#initialize(result_tag, winner_tag) ⇒ ResultSet
constructor
A new instance of ResultSet.
- #lotteries ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize(result_tag, winner_tag) ⇒ ResultSet
Returns a new instance of ResultSet.
7 8 9 10 11 |
# File 'lib/weather_funds/result_set.rb', line 7 def initialize(result_tag, winner_tag) @result_tag = result_tag @winner_tag = winner_tag @data = Nokogiri::XML(open("http://weatherfunds.co.uk/windata.xml")) end |
Instance Method Details
#date ⇒ Object
13 14 15 |
# File 'lib/weather_funds/result_set.rb', line 13 def date @data.css('wl').first['wdate'] end |
#find(name) ⇒ Object
25 26 27 |
# File 'lib/weather_funds/result_set.rb', line 25 def find(name) @lotteries.select { |lottery| lottery.name == name }[0] end |
#find_by_scheme(scheme) ⇒ Object
29 30 31 |
# File 'lib/weather_funds/result_set.rb', line 29 def find_by_scheme(scheme) @lotteries.select { |lottery| lottery.scheme == scheme }[0] end |
#lotteries ⇒ Object
21 22 23 |
# File 'lib/weather_funds/result_set.rb', line 21 def lotteries @lotteries ||= extract_winners end |
#results ⇒ Object
17 18 19 |
# File 'lib/weather_funds/result_set.rb', line 17 def results @results ||= extract_results end |