module Smartdict::Commands::HasFormatList::ClassMethods

Public Instance Methods

help_message_with_formats() click to toggle source
# File lib/smartdict/commands/has_format_list.rb, line 13
def help_message_with_formats
  formats = Smartdict::Core::FormatManager.all
  width = formats.values.map{|f| f.name.size}.max
  indent = Smartdict::Commands::AbstractCommand::INDENT_SIZE

  message  = " " * indent + "Formats:\n"
  formats.each do |name, format|
    message << " " * 2 * indent
    message << name.ljust(width) + "    "
    message << "#{format.description}\n"
  end

  help_message_without_formats << message
end