Sha256: d8a664714f6cedc5f8e66b0f41cc9b68cf9fcbe8ff6be836397deeead2eacdd7
Contents?: true
Size: 616 Bytes
Versions: 5
Compression:
Stored size: 616 Bytes
Contents
desc "knows", I18n.t("scripts.knows") command(/knows/i) do im KnownFormmater.new(know_how).format end class KnownFormmater def initialize(actions) @actions = actions @max_size = @actions.keys.map(&:length).max end def format @actions.inject("```\n") { |_message, command| _message << format_command(command) + "\n" } + "```" end private def name(command_name) pad = @max_size - command_name.length (" " * pad) + command_name end def format_command(command) message = name command.first message << ": #{command.last}" if command.last message end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
boty-0.1.0 | script/knows.rb |
boty-0.0.17.1 | script/knows.rb |
boty-0.0.17 | script/knows.rb |
boty-0.0.16 | script/knows.rb |
boty-0.0.15 | script/knows.rb |