Sha256: 96da047a5f07f59c62c85ecb99432c35d68892c6d107017fefc8eddc7a930039

Contents?: true

Size: 708 Bytes

Versions: 4

Compression:

Stored size: 708 Bytes

Contents

module AtpScraper
  module Activities
    # Activity Record Class
    class Record
      def initialize(doc)
        @record = doc
      end

      def get
        result = {}
        @record.css("td").each_with_index do |td, n|
          record_content = td.content.strip
          case n
          when 0 then
            result[:round] = record_content
          when 1 then
            result[:opponent_rank] = record_content
          when 2 then
            result[:opponent_name] = record_content
          when 3 then
            result[:win_loss] = record_content
          when 4 then
            result[:score] = record_content
          end
        end
        result
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
atp_scraper-0.7.0 lib/atp_scraper/activities/record.rb
atp_scraper-0.6.3 lib/atp_scraper/activities/record.rb
atp_scraper-0.6.2 lib/atp_scraper/activities/record.rb
atp_scraper-0.6.1 lib/atp_scraper/activities/record.rb