Class: Depix::Binary::Fields::U16Field
- Inherits:
-
Field
- Object
- Field
- Depix::Binary::Fields::U16Field
show all
- Defined in:
- lib/depix/binary/fields.rb
Overview
Constant Summary
collapse
- BLANK =
0xFFFF
Instance Attribute Summary
Attributes inherited from Field
#desc, #name, #req
Instance Method Summary
collapse
Methods inherited from Field
#consume!, #explain, #initialize, #pack
Instance Method Details
#clean(v) ⇒ Object
151
152
153
|
# File 'lib/depix/binary/fields.rb', line 151
def clean(v)
(v == BLANK || v == -1) ? nil : v
end
|
#length ⇒ Object
143
144
145
|
# File 'lib/depix/binary/fields.rb', line 143
def length
2
end
|
#pattern ⇒ Object
139
140
141
|
# File 'lib/depix/binary/fields.rb', line 139
def pattern
"n"
end
|
#rtype ⇒ Object
147
148
149
|
# File 'lib/depix/binary/fields.rb', line 147
def rtype
Integer
end
|
#validate!(value) ⇒ Object
155
156
157
158
|
# File 'lib/depix/binary/fields.rb', line 155
def validate!(value)
super(value)
raise "#{name} value #{value} out of bounds for 16bit unsigned int" if (value < 0 || value >= BLANK)
end
|