Module: GitDB::Commands

Defined in:
lib/git-db/commands.rb

Defined Under Namespace

Classes: ReceivePack, UploadPack

Class Method Summary collapse

Class Method Details

.commandsObject



3
4
5
# File 'lib/git-db/commands.rb', line 3

def self.commands
  @commands
end

.execute(command, args = []) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/git-db/commands.rb', line 7

def self.execute(command, args=[])
  return unless commands
  raise ArgumentError, "Unknown command: #{command}" unless commands[command]
  commands[command].execute(args)
end

.register(command, klass) ⇒ Object



13
14
15
16
# File 'lib/git-db/commands.rb', line 13

def self.register(command, klass)
  @commands ||= {}
  @commands[command] = klass.new
end