Class: Depix::U16Field

Inherits:
Field
  • Object
show all
Defined in:
lib/depix/dict.rb

Constant Summary collapse

BLANK =
0xFFFF

Instance Attribute Summary

Attributes inherited from Field

#desc, #name, #req

Instance Method Summary collapse

Methods inherited from Field

#consume!, emit_char, emit_r32, emit_u16, emit_u32, emit_u8, #explain, #initialize, #pack

Constructor Details

This class inherits a constructor from Depix::Field

Instance Method Details

#clean(v) ⇒ Object



187
188
189
# File 'lib/depix/dict.rb', line 187

def clean(v)
  v == BLANK ? nil : v
end

#lengthObject



179
180
181
# File 'lib/depix/dict.rb', line 179

def length
  2
end

#patternObject



175
176
177
# File 'lib/depix/dict.rb', line 175

def pattern
  "n"
end

#rtypeObject



183
184
185
# File 'lib/depix/dict.rb', line 183

def rtype
  Integer
end

#validate!(value) ⇒ Object



191
192
193
194
# File 'lib/depix/dict.rb', line 191

def validate!(value)
  super(value)
  raise "#{name} value #{value} out of bounds for 16bit unsigned int" if (value < 0 || value >= BLANK)
end