Skip to content

Instantly share code, notes, and snippets.

@rboyd
Created October 18, 2009 00:32
Show Gist options
  • Save rboyd/212500 to your computer and use it in GitHub Desktop.
Save rboyd/212500 to your computer and use it in GitHub Desktop.
require 'cmdparse'
class CommandLoader
def initialize(client)
@client = client
end
def loadCommands
cmd = CmdParse::CommandParser.new(false, true)
Dir.glob(File.join(File.dirname(__FILE__), '../commands/*.rb')).each do |f|
require f
# drop the path and .rb extension to get classname
f.sub! /.*\/(.*)\.rb/, '\1'
cmd.add_command(Kernel.const_get(f).new(@client))
end
return cmd
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment