Class: VertxRedis::Request

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

Overview

Builder for REDIS requests that will be encoded according to the RESP protocol was introduced in Redis 1.2. Which became the standard way for talking with the Redis server in Redis 2.0. Redis protocol documentation states:
Clients send commands to a Redis server as a RESP Array of Bulk Strings.
So all non String/Bulk types will be encoded to Bulk for convenience.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

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

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

+ (::VertxRedis::Request) cmd(command = nil)

Parameters:

Returns:

Raises:

  • (ArgumentError)

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

def self.cmd(command=nil)
  if command.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxRedisClient::Request.java_method(:cmd, [Java::IoVertxRedisClient::Command.java_class]).call(command.j_del),::VertxRedis::Request)
  end
  raise ArgumentError, "Invalid arguments when calling cmd(#{command})"
end

+ (Object) j_api_type


37
38
39
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/request.rb', line 37

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


40
41
42
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/request.rb', line 40

def self.j_class
  Java::IoVertxRedisClient::Request.java_class
end

+ (Object) unwrap(obj)


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

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

+ (Object) wrap(obj)


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

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

Instance Method Details

- (self) arg(arg) - (self) arg(arg) - (self) arg(arg) - (self) arg(arg) - (self) arg(arg, enc)

Adds a String using a specific character encoding argument

Overloads:

  • - (self) arg(arg)

    Parameters:

    • arg (String)
  • - (self) arg(arg)

    Parameters:

  • - (self) arg(arg)

    Parameters:

    • arg (Fixnum)
  • - (self) arg(arg)

    Parameters:

    • arg (true, false)
  • - (self) arg(arg, enc)

    Parameters:

    • arg (String)
    • enc (String)

Returns:

  • (self)

Raises:

  • (ArgumentError)

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/request.rb', line 64

def arg(param_1=nil,param_2=nil)
  if param_1.class == String && !block_given? && param_2 == nil
    @j_del.java_method(:arg, [Java::java.lang.String.java_class]).call(param_1)
    return self
  elsif param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil
    @j_del.java_method(:arg, [Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1.j_del)
    return self
  elsif param_1.class == Fixnum && !block_given? && param_2 == nil
    @j_del.java_method(:arg, [Java::long.java_class]).call(param_1)
    return self
  elsif (param_1.class == TrueClass || param_1.class == FalseClass) && !block_given? && param_2 == nil
    @j_del.java_method(:arg, [Java::boolean.java_class]).call(param_1)
    return self
  elsif param_1.class == String && param_2.class == String && !block_given?
    @j_del.java_method(:arg, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(param_1,param_2)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling arg(#{param_1},#{param_2})"
end

- (::VertxRedis::Command) command

Get the Command that is to be used by this request.

Returns:

Raises:

  • (ArgumentError)

94
95
96
97
98
99
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/request.rb', line 94

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

- (self) null_arg

Adds a NULL encoded string

Returns:

  • (self)

Raises:

  • (ArgumentError)

85
86
87
88
89
90
91
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/request.rb', line 85

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