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

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

Instance Method Summary collapse

Instance Method Details

#resultString

Returns:

  • (String)


14
15
16
# File 'lib/ehbrs_ruby_utils/bga/game_statistics/whatsapp_formatter/player_title.rb', line 14

def result
  username_by_tables || player.name
end

#username_by_table(table) ⇒ String?

Parameters:

Returns:

  • (String, nil)


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

def username_by_table(table)
  table.player_by_id(player.id).if_present(&:name)
end

#username_by_tablesString?

Returns:

  • (String, nil)


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

def username_by_tables
  formatter.with_players_tables.lazy.map { |table| username_by_table(table) }
    .find(&:present?)
end