Class: Aerospike::BytesValue
- Inherits:
-
Value
- Object
- Value
- Aerospike::BytesValue
show all
- Defined in:
- lib/aerospike/value/value.rb
Overview
Instance Method Summary
collapse
Methods inherited from Value
get_packer, of, put_packer
Constructor Details
#initialize(value) ⇒ BytesValue
115
116
117
118
119
120
|
# File 'lib/aerospike/value/value.rb', line 115
def initialize(value)
@bytes = value
@bytes.force_encoding('binary')
self
end
|
Instance Method Details
#estimate_size ⇒ Object
138
139
140
|
# File 'lib/aerospike/value/value.rb', line 138
def estimate_size
@bytes.bytesize
end
|
#get ⇒ Object
126
127
128
|
# File 'lib/aerospike/value/value.rb', line 126
def get
@bytes
end
|
#pack(packer) ⇒ Object
146
147
148
|
# File 'lib/aerospike/value/value.rb', line 146
def pack(packer)
packer.write(Aerospike::ParticleType::BLOB.chr + @bytes)
end
|
#to_bytes ⇒ Object
134
135
136
|
# File 'lib/aerospike/value/value.rb', line 134
def to_bytes
@bytes.bytes
end
|
#to_s ⇒ Object
130
131
132
|
# File 'lib/aerospike/value/value.rb', line 130
def to_s
@bytes.to_s
end
|
#type ⇒ Object
122
123
124
|
# File 'lib/aerospike/value/value.rb', line 122
def type
Aerospike::ParticleType::BLOB
end
|
#write(buffer, offset) ⇒ Object
142
143
144
|
# File 'lib/aerospike/value/value.rb', line 142
def write(buffer, offset)
buffer.write_binary(@bytes, offset)
end
|