Class: BostonMarathon::ResultSet
- Inherits:
-
Array
- Object
- Array
- BostonMarathon::ResultSet
- Defined in:
- lib/boston_marathon/result_set.rb
Instance Method Summary collapse
-
#initialize(response) ⇒ ResultSet
constructor
A new instance of ResultSet.
Constructor Details
#initialize(response) ⇒ ResultSet
Returns a new instance of ResultSet.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/boston_marathon/result_set.rb', line 5 def initialize(response) noko = Nokogiri::HTML(response.body) results = [] headers = noko.css('.tr_header') infogrids = noko.css('.table_infogrid') unless headers.empty? || infogrids.empty? headers.zip(infogrids).map { |arr| results << Result.new(arr[0], arr[1]) } end replace(results) end |