Class List Method List File List

# Class: VertxShell::CommandResolver

Inherits:
  Object
  - Object
  - VertxShell::CommandResolver
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb

## Overview

A resolver for commands, so the shell can discover commands.

## Direct Known Subclasses

CommandRegistry

## Class Method Summary (collapse)

- + (::VertxShell::CommandResolver) base_commands(vertx = nil)
  @return the base commands of Vert.x Shell.

## Instance Method Summary (collapse)

- - (Array<::VertxShell::Command>) commands
  @return the current commands.
- - (::VertxShell::Command) get_command(name = nil)
  Returns a single command by its name.

## Class Method Details

### + (`::VertxShell::CommandResolver`) base_commands(vertx = nil)

@return the base commands of Vert.x Shell.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)

Returns:

- (`::VertxShell::CommandResolver`)

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb', line 21

    def self.base_commands(vertx=nil)
      if vertx.class.method_defined?(:j_del) && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellCommand::CommandResolver.java_method(:baseCommands, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxShell::CommandResolver)
      end
      raise ArgumentError, "Invalid arguments when calling base_commands(vertx)"
    end

## Instance Method Details

### - (`Array<::VertxShell::Command>`) commands

@return the current commands

Returns:

- (`Array<::VertxShell::Command>`)

Raises:

- (`ArgumentError`)

    29
    30
    31
    32
    33
    34
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb', line 29

    def commands
      if !block_given?
        return @j_del.java_method(:commands, []).call().to_a.map { |elt| ::Vertx::Util::Utils.safe_create(elt,::VertxShell::Command) }
      end
      raise ArgumentError, "Invalid arguments when calling commands()"
    end

### - (`::VertxShell::Command`) get_command(name = nil)

Returns a single command by its name.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the command name

Returns:

- (`::VertxShell::Command`) —
  the commad or null

Raises:

- (`ArgumentError`)

    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb', line 38

    def get_command(name=nil)
      if name.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getCommand, [Java::java.lang.String.java_class]).call(name),::VertxShell::Command)
      end
      raise ArgumentError, "Invalid arguments when calling get_command(name)"
    end