Class: Aerospike::BytesValue
- Defined in:
- lib/aerospike/value/value.rb
Overview
Byte array value.
Constant Summary
Constants inherited from 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:
186 187 188 189 190 191 |
# File 'lib/aerospike/value/value.rb', line 186 def initialize(value) @bytes = value @bytes.force_encoding('binary') self end |
Instance Method Details
#estimate_size ⇒ Object
209 210 211 |
# File 'lib/aerospike/value/value.rb', line 209 def estimate_size @bytes.bytesize end |
#get ⇒ Object
197 198 199 |
# File 'lib/aerospike/value/value.rb', line 197 def get @bytes end |
#pack(packer) ⇒ Object
217 218 219 |
# File 'lib/aerospike/value/value.rb', line 217 def pack(packer) packer.write(Aerospike::ParticleType::BLOB.chr + @bytes) end |
#to_bytes ⇒ Object
205 206 207 |
# File 'lib/aerospike/value/value.rb', line 205 def to_bytes @bytes end |
#to_s ⇒ Object
201 202 203 |
# File 'lib/aerospike/value/value.rb', line 201 def to_s @bytes.to_s end |
#type ⇒ Object
193 194 195 |
# File 'lib/aerospike/value/value.rb', line 193 def type Aerospike::ParticleType::BLOB end |
#write(buffer, offset) ⇒ Object
213 214 215 |
# File 'lib/aerospike/value/value.rb', line 213 def write(buffer, offset) buffer.write_binary(@bytes, offset) end |