Sha256: 099142756ee0f9e4baed06b7e0fa1e02db2f13a833171fbac85744090965fa28

Contents?: true

Size: 536 Bytes

Versions: 2

Compression:

Stored size: 536 Bytes

Contents

module ThreeScaleToolbox
  module Command
    def subcommands
      @subcommands ||= []
    end

    def add_subcommand(command)
      subcommands << command
    end

    ##
    # Override to command
    #
    def command
      raise Exception, 'base command has no command definition'
    end

    ##
    # Iterate recursively over command tree
    #
    def build_command
      subcommands.each_with_object(command) do |subcommand, root_command|
        root_command.add_command(subcommand.build_command)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
3scale_toolbox-0.5.1 lib/3scale_toolbox/base_command.rb
3scale_toolbox-0.5.0 lib/3scale_toolbox/base_command.rb