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(*args)
Get this multi response value at a string key.
-
- (Set<String>) getKeys
Get this multi response keys from a hash.
-
- (Fixnum) size
Get this size of this multi response.
-
- (true, false) toBoolean
Get this response as a Boolean.
-
- (::Vertx::Buffer) toBuffer
Get this response as Buffer.
-
- (Fixnum) toByte
Get this response as a Byte.
-
- (Fixnum) toInteger
Get this response as a Integer.
-
- (Fixnum) toLong
Get this response as a Long.
-
- (Fixnum) toShort
Get this response as a Short.
-
- (String) toString
Get this response as a String.
-
- (:SIMPLE, ...) type
The response return type.
Class Method Details
+ (Boolean) accept?(obj)
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 30 def @@j_api_type.accept?(obj) obj.class == Response end |
+ (Object) j_api_type
39 40 41 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 39 def self.j_api_type @@j_api_type end |
+ (Object) j_class
42 43 44 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 42 def self.j_class Java::IoVertxRedisClient::Response.java_class end |
+ (Object) unwrap(obj)
36 37 38 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 36 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 33 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.
104 105 106 107 108 109 110 111 112 113 114 115 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 104 def get(*args) if args[0].class == Fixnum && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::int.java_class]).call(args[0]),::VertxRedis::Response) elsif args[0].class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(args[0]),::VertxRedis::Response) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get(#{args[0]})" end end |
- (Set<String>) getKeys
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.
146 147 148 149 150 151 152 153 154 155 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 146 def get_keys if !block_given? return ::Vertx::Util::Utils.to_set(@j_del.java_method(:getKeys, []).call()).map! { |elt| elt } end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get_keys()" end end |
- (Fixnum) size
Get this size of this multi response.
61 62 63 64 65 66 67 68 69 70 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 61 def size if !block_given? return @j_del.java_method(:size, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling size()" end end |
- (true, false) toBoolean
Get this response as a Boolean.
74 75 76 77 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 74 def to_boolean? if !block_given? return @j_del.java_method(:toBoolean, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_boolean?()" end end |
- (::Vertx::Buffer) toBuffer
Get this response as Buffer.
119 120 121 122 123 124 125 126 127 128 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 119 def to_buffer if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:toBuffer, []).call(),::Vertx::Buffer) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_buffer()" end end |
- (Fixnum) toByte
Get this response as a Byte.
172 173 174 175 176 177 178 179 180 181 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 172 def to_byte if !block_given? return @j_del.java_method(:toByte, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_byte()" end end |
- (Fixnum) toInteger
Get this response as a Integer.
48 49 50 51 52 53 54 55 56 57 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 48 def to_integer if !block_given? return @j_del.java_method(:toInteger, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_integer()" end end |
- (Fixnum) toLong
Get this response as a Long.
87 88 89 90 91 92 93 94 95 96 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 87 def to_long if !block_given? return @j_del.java_method(:toLong, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_long()" end end |
- (Fixnum) toShort
Get this response as a Short.
185 186 187 188 189 190 191 192 193 194 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 185 def to_short if !block_given? return @j_del.java_method(:toShort, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_short()" end end |
- (String) toString
Get this response as a String.
132 133 134 135 136 137 138 139 140 141 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 132 def to_string if !block_given? return @j_del.java_method(:toString, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling to_string()" end end |
- (:SIMPLE, ...) type
The response return type.
159 160 161 162 163 164 165 166 167 168 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-redis/response.rb', line 159 def type if !block_given? return @j_del.java_method(:type, []).call().name.intern end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling type()" end end |