Class: Aerospike::StringValue
- Defined in:
- lib/aerospike/value/value.rb
Overview
value string.
Constant Summary
Constants inherited from Value
Instance Method Summary collapse
- #estimate_size ⇒ Object
- #get ⇒ Object
-
#initialize(val) ⇒ StringValue
constructor
:nodoc:.
- #pack(packer) ⇒ Object
- #to_bytes ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
- #type ⇒ Object
- #write(buffer, offset) ⇒ Object
Methods inherited from Value
Constructor Details
#initialize(val) ⇒ StringValue
:nodoc:
228 229 230 231 |
# File 'lib/aerospike/value/value.rb', line 228 def initialize(val) @value = val || '' self end |
Instance Method Details
#estimate_size ⇒ Object
233 234 235 |
# File 'lib/aerospike/value/value.rb', line 233 def estimate_size @value.bytesize end |
#get ⇒ Object
250 251 252 |
# File 'lib/aerospike/value/value.rb', line 250 def get @value end |
#pack(packer) ⇒ Object
242 243 244 |
# File 'lib/aerospike/value/value.rb', line 242 def pack(packer) packer.write(Aerospike::ParticleType::STRING.chr + @value) end |
#to_bytes ⇒ Object
254 255 256 |
# File 'lib/aerospike/value/value.rb', line 254 def to_bytes @value end |
#to_s ⇒ Object
258 259 260 |
# File 'lib/aerospike/value/value.rb', line 258 def to_s @value end |
#to_sym ⇒ Object
262 263 264 |
# File 'lib/aerospike/value/value.rb', line 262 def to_sym @value.to_sym end |
#type ⇒ Object
246 247 248 |
# File 'lib/aerospike/value/value.rb', line 246 def type Aerospike::ParticleType::STRING end |
#write(buffer, offset) ⇒ Object
237 238 239 240 |
# File 'lib/aerospike/value/value.rb', line 237 def write(buffer, offset) bytes = @value.encode(Aerospike.encoding).force_encoding(Encoding::BINARY) buffer.write_binary(bytes, offset) end |