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:
103 104 105 106 107 108 |
# File 'lib/aerospike/value/value.rb', line 103 def initialize(value) @bytes = value @bytes.force_encoding('binary') self end |
Instance Method Details
#estimate_size ⇒ Object
126 127 128 |
# File 'lib/aerospike/value/value.rb', line 126 def estimate_size @bytes.bytesize end |
#get ⇒ Object
114 115 116 |
# File 'lib/aerospike/value/value.rb', line 114 def get @bytes end |
#pack(packer) ⇒ Object
134 135 136 |
# File 'lib/aerospike/value/value.rb', line 134 def pack(packer) packer.write(Aerospike::ParticleType::BLOB.chr + @bytes) end |
#to_bytes ⇒ Object
122 123 124 |
# File 'lib/aerospike/value/value.rb', line 122 def to_bytes @bytes.bytes end |
#to_s ⇒ Object
118 119 120 |
# File 'lib/aerospike/value/value.rb', line 118 def to_s @bytes.to_s end |
#type ⇒ Object
110 111 112 |
# File 'lib/aerospike/value/value.rb', line 110 def type Aerospike::ParticleType::BLOB end |
#write(buffer, offset) ⇒ Object
130 131 132 |
# File 'lib/aerospike/value/value.rb', line 130 def write(buffer, offset) buffer.write_binary(@bytes, offset) end |