Class: EhbrsRubyUtils::Bga::Table::WhatsappFormatters::Base
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::Bga::Table::WhatsappFormatters::Base
show all
- Defined in:
- lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb,
lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base/format_option.rb,
lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base/format_player.rb
Defined Under Namespace
Classes: FormatOption, FormatPlayer
Constant Summary
collapse
''
- ROOT_ITENS =
{
'Jogo' => :game_name,
'Criada em' => :creation_time,
'Duração' => :estimated_duration,
'Endereço' => :url
}.freeze
- SECTION_SEPARATOR =
"\n\n"
Instance Method Summary
collapse
Instance Method Details
#image_local_path ⇒ Pathname
24
25
26
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 24
def image_local_path
table.game.box_large_image.local_path
end
|
#options ⇒ Object
59
60
61
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 59
def options
table.options.map { |player| format_option(player) }
end
|
#options_to_s ⇒ Object
37
38
39
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 37
def options_to_s
title_to_s('Opções') + options.join("\n")
end
|
#players ⇒ Object
55
56
57
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 55
def players
table.players.map { |player| format_player(player) }
end
|
42
43
44
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 42
def
PLAYERS_EXTRA
end
|
#players_to_s ⇒ String
47
48
49
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 47
def players_to_s
title_to_s(players_title) + + players.join("\n")
end
|
#root_items_to_s ⇒ Object
32
33
34
35
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 32
def root_items_to_s
title_to_s(root_items_title) + ROOT_ITENS.map { |k, v| "*#{k}*: #{table.send(v)}" }
.join("\n")
end
|
#title_to_s(title) ⇒ Object
51
52
53
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 51
def title_to_s(title)
"*#{[title_icon, title, title_icon].join(' ')}*\n\n"
end
|
#to_s ⇒ Object
28
29
30
|
# File 'lib/ehbrs_ruby_utils/bga/table/whatsapp_formatters/base.rb', line 28
def to_s
[root_items_to_s, players_to_s, options_to_s].map(&:strip).join(SECTION_SEPARATOR)
end
|