Sha256: b5c20afb44b543e61168a9f0f310ee9cecf04cb77874b896eb811b98e2cb5620

Contents?: true

Size: 907 Bytes

Versions: 3

Compression:

Stored size: 907 Bytes

Contents

# frozen_string_literal: true

require 'aranha/parsers/html/item'
require 'aranha/parsers/html/item_list'
require 'eac_ruby_utils/core_ext'

module EhbrsRubyUtils
  module Bga
    module Parsers
      class Table < ::Aranha::Parsers::Html::Item
        class Players < ::Aranha::Parsers::Html::ItemList
          ITEMS_XPATH = '//div[starts-with(@id, "score_entry_")]'

          field :table_rank, :integer, './div[@class = "rank"]'
          field :id, :integer, './div[@class = "name"]/a/@href'
          field :name, :string, './div[@class = "name"]/a/text()'
          field :score, :integer_optional, './div[@class = "score"]'
          field :win_points, :string, './/*[starts-with(@id, "winpoints_value_")]/text()'
          field :game_rank, :integer, './/*[@class = "gamerank_value"]/text()'

          def items_xpath
            ITEMS_XPATH
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.25.1 lib/ehbrs_ruby_utils/bga/parsers/table/players.rb
ehbrs_ruby_utils-0.25.0 lib/ehbrs_ruby_utils/bga/parsers/table/players.rb
ehbrs_ruby_utils-0.24.1 lib/ehbrs_ruby_utils/bga/parsers/table/players.rb