Class: Aerospike::StringValue
- Defined in:
- lib/aerospike/value/value.rb
Overview
value string.
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:
145 146 147 148 |
# File 'lib/aerospike/value/value.rb', line 145 def initialize(val) @value = val || '' self end |
Instance Method Details
#estimate_size ⇒ Object
150 151 152 |
# File 'lib/aerospike/value/value.rb', line 150 def estimate_size @value.bytesize end |
#get ⇒ Object
167 168 169 |
# File 'lib/aerospike/value/value.rb', line 167 def get @value end |
#pack(packer) ⇒ Object
159 160 161 |
# File 'lib/aerospike/value/value.rb', line 159 def pack(packer) packer.write(Aerospike::ParticleType::STRING.chr + @value) end |
#to_bytes ⇒ Object
171 172 173 |
# File 'lib/aerospike/value/value.rb', line 171 def to_bytes @value end |
#to_s ⇒ Object
175 176 177 |
# File 'lib/aerospike/value/value.rb', line 175 def to_s @value end |
#to_sym ⇒ Object
179 180 181 |
# File 'lib/aerospike/value/value.rb', line 179 def to_sym @value.to_sym end |
#type ⇒ Object
163 164 165 |
# File 'lib/aerospike/value/value.rb', line 163 def type Aerospike::ParticleType::STRING end |
#write(buffer, offset) ⇒ Object
154 155 156 157 |
# File 'lib/aerospike/value/value.rb', line 154 def write(buffer, offset) bytes = @value.encode(Aerospike.encoding).force_encoding(Encoding::BINARY) buffer.write_binary(bytes, offset) end |