Class: VertxShell::CommandResolver

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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:

Returns:

Raises:

  • (ArgumentError)


36
37
38
39
40
41
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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:

Raises:

  • (ArgumentError)


43
44
45
46
47
48
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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:

Raises:

  • (ArgumentError)


52
53
54
55
56
57
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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