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

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxShell::CommandResolver) base_commands(vertx = nil)
  The base commands of Vert.x Shell.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

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

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb', line 19

    def @@j_api_type.accept?(obj)
      obj.class == CommandResolver
    end

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

Returns the base commands of Vert.x Shell.

Parameters:

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

Returns:

- (`::VertxShell::CommandResolver`) —
  the base commands of Vert.x Shell.

Raises:

- (`ArgumentError`)

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

    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

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

    def self.j_class
      Java::IoVertxExtShellCommand::CommandResolver.java_class
    end

### + (`Object`) unwrap(obj)

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

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

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

    def @@j_api_type.wrap(obj)
      CommandResolver.new(obj)
    end

## Instance Method Details

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

Returns the current commands

Returns:

- (`Array<::VertxShell::Command>`) —
  the current commands

Raises:

- (`ArgumentError`)

    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb', line 43

    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`)

    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/command_resolver.rb', line 52

    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