class Pechkin::Command::List
List
channels configuration
Public Instance Methods
execute()
click to toggle source
# File lib/pechkin/command/list.rb, line 12 def execute cfg = configuration puts "Working dir: #{cfg.working_dir}" print_bots(cfg.bots) print_channels(cfg.channels) end
matches?()
click to toggle source
# File lib/pechkin/command/list.rb, line 8 def matches? options.list? end
Private Instance Methods
print_bots(bots)
click to toggle source
# File lib/pechkin/command/list.rb, line 22 def print_bots(bots) puts "\nBots:" puts format(BOT_ENTRY_FORMAT, 'NAME', 'CONNECTOR', 'TOKEN') bots.each do |name, bot| puts format(BOT_ENTRY_FORMAT, name, bot.connector, bot.token) end end
print_channels(channels)
click to toggle source
# File lib/pechkin/command/list.rb, line 30 def print_channels(channels) puts "\nChannels:" puts format(CHAT_ENTRY_FORMAT, 'CHANNEL', 'MESSAGE', 'BOT') channels.each do |channel_name, channel| channel.messages.each do |message_name, _message| puts format(CHAT_ENTRY_FORMAT, channel_name, message_name, channel.connector.name) end end end