Class: VertxShell::Command

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb

Overview

A Vert.x Shell command, it can be created from any language using the VertxShell::CommandBuilder#command or from a Java class using #create

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 22

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

+ (Object) j_api_type



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 31

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 34

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

+ (Object) unwrap(obj)



28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 28

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

+ (Object) wrap(obj)



25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 25

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

Instance Method Details

- (::Vertx::CLI) cli

Returns the command line interface, can be null

Returns:

  • (::Vertx::CLI)
    the command line interface, can be null

Raises:

  • (ArgumentError)


45
46
47
48
49
50
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 45

def cli
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:cli, []).call(),::Vertx::CLI)
  end
  raise ArgumentError, "Invalid arguments when calling cli()"
end

- (void) complete(completion = nil)

This method returns an undefined value.

Perform command completion, when the command is done completing it should call or )} method to signal completion is done.

Parameters:

Raises:

  • (ArgumentError)


66
67
68
69
70
71
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 66

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

- (::VertxShell::Process) create_process(args = nil)

Create a new process with the passed arguments.

Parameters:

Returns:

Raises:

  • (ArgumentError)


54
55
56
57
58
59
60
61
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 54

def create_process(args=nil)
  if !block_given? && args == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createProcess, []).call(),::VertxShell::Process)
  elsif args.class == Array && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createProcess, [Java::JavaUtil::List.java_class]).call(args.map { |element| element.j_del }),::VertxShell::Process)
  end
  raise ArgumentError, "Invalid arguments when calling create_process(#{args})"
end

- (String) name

Returns the command name

Returns:

  • (String)
    the command name

Raises:

  • (ArgumentError)


38
39
40
41
42
43
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/command.rb', line 38

def name
  if !block_given?
    return @j_del.java_method(:name, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling name()"
end