Class: RubyVolt::DataType::AppDataType

Inherits:
Byte show all
Extended by:
Extensions::CodeValuesHash
Defined in:
lib/ruby_volt/data_type/app_data_type.rb

Direct Known Subclasses

ProcedureCallStatusCode, WireTypeInfo

Constant Summary

Constants inherited from Byte

Byte::DIRECTIVE, Byte::LENGTH, Byte::NULL_INDICATOR

Instance Attribute Summary

Attributes included from Extensions::CodeValuesHash

#code_values, #codes

Class Method Summary collapse

Methods included from Extensions::CodeValuesHash

hash_codes, inherited

Methods inherited from Basic

bytesToInt, intToBytes

Methods inherited from RubyVolt::DataType

classifyDataType, testpacking, voltDataType

Class Method Details

.pack(val) ⇒ Object



7
8
9
10
# File 'lib/ruby_volt/data_type/app_data_type.rb', line 7

def pack(val)
  val = val.is_a?(::Integer) ? val : code_values[val]
  super(val)
end

.unpack(bytes) ⇒ Object



12
13
14
15
16
# File 'lib/ruby_volt/data_type/app_data_type.rb', line 12

def unpack(bytes)
  if unpacked = super(bytes)
    codes[unpacked]
  end
end