Sha256: 6f035a672ada02955285d18cf3931e08d0048bfc47198ffa07d9487907ce2a22

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 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] = AtpScraper::Utility.convert_score(record_content)
          end
        end
        result
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
atp_scraper-0.7.2 lib/atp_scraper/activities/record.rb