Module: Smartdict::Commands::HasFormatList::ClassMethods

Defined in:
lib/smartdict/commands/has_format_list.rb

Instance Method Summary collapse

Instance Method Details

#help_message_with_formatsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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