Class: EhbrsRubyUtils::Bga::Parsers::Table

Inherits:
Aranha::Parsers::Html::Item
  • Object
show all
Defined in:
lib/ehbrs_ruby_utils/bga/parsers/table.rb,
lib/ehbrs_ruby_utils/bga/parsers/table/options.rb,
lib/ehbrs_ruby_utils/bga/parsers/table/ended_players.rb,
lib/ehbrs_ruby_utils/bga/parsers/table/active_players.rb

Defined Under Namespace

Classes: ActivePlayers, EndedPlayers, Options

Constant Summary collapse

GAME_IMAGE_URL_PARSER =
%r{/gamemedia/([^/]+)/box/}.to_parser { |m| m[1] }
ITEM_XPATH =
'/'
PLAYERS_IDS =
{
  'game_result' => ::EhbrsRubyUtils::Bga::Parsers::Table::EndedPlayers,
  'players_at_table' => ::EhbrsRubyUtils::Bga::Parsers::Table::ActivePlayers
}.freeze
PLAYERS_IDS_XPATH =
PLAYERS_IDS.keys.map { |id| "@id = \"#{id}\"" }.join(' or ')
PLAYERS_XPATH =
".//*[(#{PLAYERS_IDS_XPATH}) and count(./*) > 0]"

Instance Method Summary collapse

Instance Method Details

#dataObject



33
34
35
36
37
38
39
# File 'lib/ehbrs_ruby_utils/bga/parsers/table.rb', line 33

def data
  r = super
  %i[creation_time game_code game_conceded options players].each do |key|
    r[key] = send("process_#{key}", r.fetch(key))
  end
  r
end

#item_xpathObject



29
30
31
# File 'lib/ehbrs_ruby_utils/bga/parsers/table.rb', line 29

def item_xpath
  ITEM_XPATH
end