module Commands

Commands

Commands

Public Instance Methods

commands() click to toggle source
# File lib/gdsh/commands.rb, line 26
def commands
  constants.select { |c| const_get(c).is_a? Class }
end
interpret(input) click to toggle source
# File lib/gdsh/commands.rb, line 43
def interpret(input)
  return Quit if input.nil?

  commands.each do |c|
    klass = const_get(c)
    return klass if input == klass.command_name
  end

  Unrecognized
end
puts_usage_header() click to toggle source
# File lib/gdsh/commands.rb, line 30
def puts_usage_header
  puts 'Commands'.colorize(:green)
  puts '--------'.colorize(:green)
end
usage() click to toggle source
# File lib/gdsh/commands.rb, line 35
def usage
  puts_usage_header
  commands.each do |c|
    klass = const_get(c)
    puts klass.description unless klass.command_name.empty?
  end
end