Class: Golem::Command::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/golem/command.rb

Overview

This class is abstract.

Subclass and override #run to implement a custom Command class.

Abstract class for commands.

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Base

Returns a new instance of Base.

Parameters:

  • opts (Hash)

    options

Options Hash (opts):

  • :verbose (Boolean)

    control verbosity.



58
59
60
# File 'lib/golem/command.rb', line 58

def initialize(opts)
    @opts = opts
end

Instance Method Details

#command(cmd, *args) ⇒ Object

Run another command.

Parameters:

  • cmd (Symbol)

    the command to run,

  • *args

    arguments for the command.



75
76
77
# File 'lib/golem/command.rb', line 75

def command(cmd, *args)
    Golem::Command.run(cmd, @opts, *args)
end

#runObject

Run the command.



68
69
70
# File 'lib/golem/command.rb', line 68

def run
    abort "Bad command."
end

#verbose?Boolean

Check verbosity.

Returns:

  • (Boolean)


63
64
65
# File 'lib/golem/command.rb', line 63

def verbose?
    !!@opts[:verbose]
end