Class: VertxShell::CommandRegistry

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb

Overview

A registry that contains the commands known by a shell.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (::VertxShell::CommandRegistry) get(vertx = nil)

Get the registry for the Vert.x instance

Parameters:

  • vertx (::Vertx::Vertx) (defaults to: nil)
    the vertx instance

Returns:

Raises:

  • (ArgumentError)


25
26
27
28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb', line 25

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

Instance Method Details

- (void) complete(completion = nil)

This method returns an undefined value.

Perform completion, the completion argument will be notified of the completion progress.

Parameters:

Raises:

  • (ArgumentError)


58
59
60
61
62
63
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb', line 58

def complete(completion=nil)
  if completion.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:complete, [Java::IoVertxExtShellCli::Completion.java_class]).call(completion.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling complete(completion)"
end

- (void) createProcess(line, handler) { ... } - (void) createProcess(line, handler) { ... }

This method returns an undefined value.

Try to create a process from the command line tokens.

Overloads:

  • - (void) createProcess(line, handler) { ... }

    Parameters:

    • line (String)
      the command line to parse

    Yields:

    • the handler to be notified about process creation
  • - (void) createProcess(line, handler) { ... }

    Parameters:

    Yields:

    • the handler to be notified about process creation

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb', line 47

def create_process(param_1=nil)
  if param_1.class == String && block_given?
    return @j_del.java_method(:createProcess, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxShell::Process) : nil) }))
  elsif param_1.class == Array && block_given?
    return @j_del.java_method(:createProcess, [Java::JavaUtil::List.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1.map { |element| element.j_del },(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxShell::Process) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling create_process(param_1)"
end

- (void) register_command(command = nil) { ... }

This method returns an undefined value.

Parameters:

Yields:

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb', line 67

def register_command(command=nil)
  if command.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:registerCommand, [Java::IoVertxExtShellCommand::Command.java_class]).call(command.j_del)
  elsif command.class.method_defined?(:j_del) && block_given?
    return @j_del.java_method(:registerCommand, [Java::IoVertxExtShellCommand::Command.java_class,Java::IoVertxCore::Handler.java_class]).call(command.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxShell::CommandRegistration) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling register_command(command)"
end

- (Array<::VertxShell::CommandRegistration>) registrations

@return the current command registrations

Returns:

Raises:

  • (ArgumentError)


33
34
35
36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb', line 33

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

- (void) unregister_command(commandName = nil) { ... }

This method returns an undefined value.

Parameters:

  • commandName (String) (defaults to: nil)

Yields:

Raises:

  • (ArgumentError)


78
79
80
81
82
83
84
85
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/command_registry.rb', line 78

def unregister_command(commandName=nil)
  if commandName.class == String && !block_given?
    return @j_del.java_method(:unregisterCommand, [Java::java.lang.String.java_class]).call(commandName)
  elsif commandName.class == String && block_given?
    return @j_del.java_method(:unregisterCommand, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(commandName,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling unregister_command(commandName)"
end