class CommandTree::Command

A command class

Attributes

block[R]
desc[R]
name[R]
prefix[R]

Public Class Methods

new(prefix, name, options = {}, &block) click to toggle source
# File lib/command_tree/command.rb, line 6
def initialize(prefix, name, options = {}, &block)
  @prefix = prefix
  @name = name
  @desc = options[:desc]
  @block = block
end

Public Instance Methods

execute() click to toggle source
# File lib/command_tree/command.rb, line 13
def execute
  print_banner
  block.call
end

Private Instance Methods

pretty_description() click to toggle source
# File lib/command_tree/command.rb, line 29
def pretty_description
  desc.to_s.light_black if desc
end
pretty_name() click to toggle source
# File lib/command_tree/command.rb, line 25
def pretty_name
  name.light_magenta.bold if name
end
print_banner() click to toggle source