Sha256: 5203cbae03353b8f3f2c8b65035f096b0ddd626948086ff4d493a69782122ce4

Contents?: true

Size: 454 Bytes

Versions: 4

Compression:

Stored size: 454 Bytes

Contents

require 'topicz/commands/_index'

module Topicz

  class CommandFactory

    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

    def create_command(name, config_file = nil, arguments = [])
      load_command(name).new(config_file, arguments)
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
topicz-0.3.0 lib/topicz/command_factory.rb
topicz-0.2.0 lib/topicz/command_factory.rb
topicz-0.1.1 lib/topicz/command_factory.rb
topicz-0.1.0 lib/topicz/command_factory.rb