Module: ThreeScaleToolbox::Command::ClassMethods

Defined in:
lib/3scale_toolbox/base_command.rb

Instance Method Summary collapse

Instance Method Details

#add_subcommand(command) ⇒ Object



12
13
14
# File 'lib/3scale_toolbox/base_command.rb', line 12

def add_subcommand(command)
  subcommands << command
end

#build_commandObject

Iterate recursively over command tree



26
27
28
29
30
# File 'lib/3scale_toolbox/base_command.rb', line 26

def build_command
  subcommands.each_with_object(command) do |subcommand, root_command|
    root_command.add_command(subcommand.build_command)
  end
end

#commandObject

Override to command

Raises:

  • (Exception)


19
20
21
# File 'lib/3scale_toolbox/base_command.rb', line 19

def command
  raise Exception, 'base command has no command definition'
end

#subcommandsObject



8
9
10
# File 'lib/3scale_toolbox/base_command.rb', line 8

def subcommands
  @subcommands ||= []
end