Created
October 18, 2009 00:32
-
-
Save rboyd/212500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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