Class: EhbrsRubyUtils::Bga::GameStatistics::WhatsappFormatter

Inherits:
Object
  • Object
show all
Includes:
WhatsappFormatter
Defined in:
lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb,
lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_title.rb,
lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_content.rb

Defined Under Namespace

Classes: PlayerContent, PlayerTitle

Constant Summary collapse

ROOT_TITLE =
'Estatísticas'
TITLE_ICON =
0x1F4CA.chr(::Encoding::UTF_8)

Constants included from WhatsappFormatter

WhatsappFormatter::LINE_SEPARATOR, WhatsappFormatter::OPTION_SEPARATOR, WhatsappFormatter::SECTION_SEPARATOR

Instance Method Summary collapse

Methods included from WhatsappFormatter

#content_to_s, #game, #image_local_path, #options_to_s, #section_to_s, #title_to_s, #to_s

Instance Method Details

#root_contentHash

Returns:

  • (Hash)


21
22
23
24
25
26
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb', line 21

def root_content
  r = { 'Jogo' => game.name, 'Mesas normais' => normal_tables.count,
        'Mesas amigáveis' => friendly_tables_count }
  until_table.if_present { |v| r['Após mesa'] = v.url }
  r
end

#sectionsHash<String, String>

Returns “title” => “content”.

Returns:

  • (Hash<String, String>)

    “title” => “content”



29
30
31
32
33
34
35
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb', line 29

def sections
  r = { ROOT_TITLE => root_content }
  players.each do |player|
    r[player_title(player)] = player_content(player)
  end
  r
end

#title_iconString

Returns:

  • (String)


38
39
40
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb', line 38

def title_icon
  TITLE_ICON
end