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:
208 209 210 211 212 213 |
# File 'lib/aerospike/value/value.rb', line 208 def initialize(value) @bytes = value @bytes.force_encoding("binary") self end |
Instance Method Details
#estimate_size ⇒ Object
231 232 233 |
# File 'lib/aerospike/value/value.rb', line 231 def estimate_size @bytes.bytesize end |
#get ⇒ Object
219 220 221 |
# File 'lib/aerospike/value/value.rb', line 219 def get @bytes end |
#pack(packer) ⇒ Object
239 240 241 |
# File 'lib/aerospike/value/value.rb', line 239 def pack(packer) packer.write(Aerospike::ParticleType::BLOB.chr + @bytes) end |
#to_bytes ⇒ Object
227 228 229 |
# File 'lib/aerospike/value/value.rb', line 227 def to_bytes @bytes end |
#to_s ⇒ Object
223 224 225 |
# File 'lib/aerospike/value/value.rb', line 223 def to_s @bytes.to_s end |
#type ⇒ Object
215 216 217 |
# File 'lib/aerospike/value/value.rb', line 215 def type Aerospike::ParticleType::BLOB end |
#write(buffer, offset) ⇒ Object
235 236 237 |
# File 'lib/aerospike/value/value.rb', line 235 def write(buffer, offset) buffer.write_binary(@bytes, offset) end |