Sha256: a92afb51002b3328863d1529fe42248879c9d5458ef9d6277dceaea7ec84e6e5
Contents?: true
Size: 651 Bytes
Versions: 15
Compression:
Stored size: 651 Bytes
Contents
module Ruboty module Actions class Help < Base def call message.reply(body, code: true) end private def body action_descriptions.join("\n") end def action_descriptions Ruboty.actions.reject(&:hidden?).sort.map do |action| prefix = "" prefix << message.robot.name << " " unless action.all? "%-#{pattern_max_length + prefix.size}s - #{action.description}" % "#{prefix}#{action.pattern.inspect}" end end def pattern_max_length Ruboty.actions.map {|action| action.pattern.inspect }.map(&:size).max end end end end
Version data entries
15 entries across 15 versions & 1 rubygems