Class: Gerrit::Command::Base Abstract

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/gerrit/command/base.rb

Overview

This class is abstract.

Abstract base class of all commands.

Direct Known Subclasses

Checkout, Groups, Help, Members, Projects, Push, Setup, Version

Instance Method Summary collapse

Methods included from Utils

camel_case, commit_hash?, map_in_parallel, snake_case

Constructor Details

#initialize(config, ui, arguments) ⇒ Base

Returns a new instance of Base.

Parameters:



13
14
15
16
17
# File 'lib/gerrit/command/base.rb', line 13

def initialize(config, ui, arguments)
  @config = config
  @ui = ui
  @arguments = arguments
end

Instance Method Details

#executeObject

Executes the command given the previously-parsed arguments.

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/gerrit/command/base.rb', line 27

def execute
  raise NotImplementedError, 'Define `execute` in Command subclass'
end

#runObject

Parses arguments and executes the command.



20
21
22
23
24
# File 'lib/gerrit/command/base.rb', line 20

def run
  # TODO: include a parse step here and remove duplicate parsing code from
  # individual commands
  execute
end