Class: RubyVolt::DataType::String

Inherits:
Varbinary show all
Defined in:
lib/ruby_volt/data_type/basic/string.rb

Constant Summary

Constants inherited from Varbinary

Varbinary::DIRECTIVE, Varbinary::NULL_INDICATOR

Class Method Summary collapse

Methods inherited from Varbinary

pack

Methods inherited from Basic

bytesToInt, intToBytes

Methods inherited from RubyVolt::DataType

classifyDataType, testpacking, voltDataType

Class Method Details

.convert_input(val) ⇒ Object



12
13
14
# File 'lib/ruby_volt/data_type/basic/string.rb', line 12

def convert_input(val)
  val.to_s.encode("utf-8")
end

.unpack(bytes) ⇒ Object



6
7
8
9
10
# File 'lib/ruby_volt/data_type/basic/string.rb', line 6

def unpack(bytes)
  if unpacked = super(bytes)
    unpacked.force_encoding("utf-8")
  end
end