class Flumtter::Command
Attributes
command[R]
help[R]
name[R]
Public Class Methods
list(commands)
click to toggle source
# File lib/flumtter/app/core/command.rb, line 15 def self.list(commands) char_len = commands.max_by{|c|c.name.size}.name.size + 1 rescue 0 commands.map do |c| c.name.ljust(char_len) + c.help end.join("\n") end
new(command, help="", &blk)
click to toggle source
# File lib/flumtter/app/core/command.rb, line 4 def initialize(command, help="", &blk) @name = command.is_a?(Regexp) ? command.inspect : command @command = command.is_a?(String) ? command.to_reg : command @help = help @blk = blk end
Public Instance Methods
call(*args)
click to toggle source
# File lib/flumtter/app/core/command.rb, line 11 def call(*args) @blk.call(*args) end