Class: Aerospike::BytesValue
- Defined in:
- lib/aerospike/value/value.rb
Overview
Byte array value.
Instance Method Summary collapse
- #estimate_size ⇒ Object
- #get ⇒ Object
-
#initialize(value) ⇒ BytesValue
constructor
:nodoc:.
- #pack(packer) ⇒ Object
- #to_bytes ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
- #write(buffer, offset) ⇒ Object
Methods inherited from Value
Constructor Details
#initialize(value) ⇒ BytesValue
:nodoc:
213 214 215 216 217 218 |
# File 'lib/aerospike/value/value.rb', line 213 def initialize(value) @bytes = value @bytes.force_encoding('binary') self end |
Instance Method Details
#estimate_size ⇒ Object
236 237 238 |
# File 'lib/aerospike/value/value.rb', line 236 def estimate_size @bytes.bytesize end |
#get ⇒ Object
224 225 226 |
# File 'lib/aerospike/value/value.rb', line 224 def get @bytes end |
#pack(packer) ⇒ Object
244 245 246 |
# File 'lib/aerospike/value/value.rb', line 244 def pack(packer) packer.write(Aerospike::ParticleType::BLOB.chr + @bytes) end |
#to_bytes ⇒ Object
232 233 234 |
# File 'lib/aerospike/value/value.rb', line 232 def to_bytes @bytes end |
#to_s ⇒ Object
228 229 230 |
# File 'lib/aerospike/value/value.rb', line 228 def to_s @bytes.to_s end |
#type ⇒ Object
220 221 222 |
# File 'lib/aerospike/value/value.rb', line 220 def type Aerospike::ParticleType::BLOB end |
#write(buffer, offset) ⇒ Object
240 241 242 |
# File 'lib/aerospike/value/value.rb', line 240 def write(buffer, offset) buffer.write_binary(@bytes, offset) end |