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

#friendly_tables_countInteger

Returns:

  • (Integer)


20
21
22
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb', line 20

def friendly_tables_count
  game_tables.count - normal_tables.count
end

#root_contentHash

Returns:

  • (Hash)


25
26
27
28
29
30
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb', line 25

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”



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

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)


42
43
44
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter.rb', line 42

def title_icon
  TITLE_ICON
end