Class: VertxRedis::Response
- Inherits:
-
Object
- Object
- VertxRedis::Response
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb
Overview
The response received from the REDIS server. Redis responses can have several representations:
- simple string - C string
- integer - 64bit integer value
- bulk - byte array
- multi - list
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (::VertxRedis::Response) get(param_1 = nil)
Get this multi response value at a string key.
-
- (Set<String>) get_keys
Get this multi response keys from a hash.
-
- (Fixnum) size
Get this size of this multi response.
-
- (true, false) to_boolean?
Get this response as a Boolean.
-
- (::Vertx::Buffer) to_buffer
Get this response as Buffer.
-
- (Fixnum) to_byte
Get this response as a Byte.
-
- (Fixnum) to_integer
Get this response as a Integer.
-
- (Fixnum) to_long
Get this response as a Long.
-
- (Fixnum) to_short
Get this response as a Short.
-
- (String) to_string
Get this response as a String.
-
- (:SIMPLE, ...) type
The response return type.
Class Method Details
+ (Boolean) accept?(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 29 def @@j_api_type.accept?(obj) obj.class == Response end |
+ (Object) j_api_type
38 39 40 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 38 def self.j_api_type @@j_api_type end |
+ (Object) j_class
41 42 43 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 41 def self.j_class Java::IoVertxRedisClient::Response.java_class end |
+ (Object) unwrap(obj)
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 35 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 32 def @@j_api_type.wrap(obj) Response.new(obj) end |
Instance Method Details
- (::VertxRedis::Response) get(index) - (::VertxRedis::Response) get(key)
Get this multi response value at a string key. Note that REDIS does not support strings as keys but by convention
it encodes hashes in lists where index i is the key, and index i+1 is the value.
115 116 117 118 119 120 121 122 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 115 def get(param_1=nil) if param_1.class == Fixnum && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::int.java_class]).call(param_1),::VertxRedis::Response) elsif param_1.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(param_1),::VertxRedis::Response) end raise ArgumentError, "Invalid arguments when calling get(#{param_1})" end |
- (Set<String>) get_keys
Get this multi response keys from a hash. Note that REDIS does not support strings as keys but by convention
it encodes hashes in lists where index i is the key, and index i+1 is the value.
126 127 128 129 130 131 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 126 def get_keys if !block_given? return ::Vertx::Util::Utils.to_set(@j_del.java_method(:getKeys, []).call()).map! { |elt| elt } end raise ArgumentError, "Invalid arguments when calling get_keys()" end |
- (Fixnum) size
Get this size of this multi response.
134 135 136 137 138 139 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 134 def size if !block_given? return @j_del.java_method(:size, []).call() end raise ArgumentError, "Invalid arguments when calling size()" end |
- (true, false) to_boolean?
Get this response as a Boolean.
94 95 96 97 98 99 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 94 def to_boolean? if !block_given? return @j_del.java_method(:toBoolean, []).call() end raise ArgumentError, "Invalid arguments when calling to_boolean?()" end |
- (::Vertx::Buffer) to_buffer
Get this response as Buffer.
102 103 104 105 106 107 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 102 def to_buffer if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:toBuffer, []).call(),::Vertx::Buffer) end raise ArgumentError, "Invalid arguments when calling to_buffer()" end |
- (Fixnum) to_byte
Get this response as a Byte.
86 87 88 89 90 91 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 86 def to_byte if !block_given? return @j_del.java_method(:toByte, []).call() end raise ArgumentError, "Invalid arguments when calling to_byte()" end |
- (Fixnum) to_integer
Get this response as a Integer.
70 71 72 73 74 75 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 70 def to_integer if !block_given? return @j_del.java_method(:toInteger, []).call() end raise ArgumentError, "Invalid arguments when calling to_integer()" end |
- (Fixnum) to_long
Get this response as a Long.
62 63 64 65 66 67 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 62 def to_long if !block_given? return @j_del.java_method(:toLong, []).call() end raise ArgumentError, "Invalid arguments when calling to_long()" end |
- (Fixnum) to_short
Get this response as a Short.
78 79 80 81 82 83 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 78 def to_short if !block_given? return @j_del.java_method(:toShort, []).call() end raise ArgumentError, "Invalid arguments when calling to_short()" end |
- (String) to_string
Get this response as a String.
54 55 56 57 58 59 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 54 def to_string if !block_given? return @j_del.java_method(:toString, []).call() end raise ArgumentError, "Invalid arguments when calling to_string()" end |
- (:SIMPLE, ...) type
The response return type.
46 47 48 49 50 51 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 46 def type if !block_given? return @j_del.java_method(:type, []).call().name.intern end raise ArgumentError, "Invalid arguments when calling type()" end |