Class: Topicz::CommandFactory
- Inherits:
-
Object
- Object
- Topicz::CommandFactory
- Defined in:
- lib/topicz/command_factory.rb
Instance Method Summary collapse
Instance Method Details
#create_command(name, config_file = nil, arguments = []) ⇒ Object
15 16 17 |
# File 'lib/topicz/command_factory.rb', line 15 def create_command(name, config_file = nil, arguments = []) load_command(name).new(config_file, arguments) end |
#load_command(name) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/topicz/command_factory.rb', line 7 def load_command(name) unless COMMANDS.has_key?name raise "Unsupported command: #{name}" end require "topicz/commands/#{name}_command" Object.const_get("Topicz::Commands::#{name.capitalize}Command") end |