Class: Depix::Binary::Fields::U8Field
- Inherits:
-
Field
- Object
- Field
- Depix::Binary::Fields::U8Field
show all
- Defined in:
- lib/depix/binary/fields.rb
Overview
Constant Summary
collapse
- BLANK =
0xFF
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
107
108
109
|
# File 'lib/depix/binary/fields.rb', line 107
def clean(v)
(v == BLANK || v == -1) ? nil : v
end
|
#length ⇒ Object
99
100
101
|
# File 'lib/depix/binary/fields.rb', line 99
def length
1
end
|
#pattern ⇒ Object
95
96
97
|
# File 'lib/depix/binary/fields.rb', line 95
def pattern
"c"
end
|
#rtype ⇒ Object
103
104
105
|
# File 'lib/depix/binary/fields.rb', line 103
def rtype
Integer
end
|
#validate!(value) ⇒ Object
111
112
113
114
|
# File 'lib/depix/binary/fields.rb', line 111
def validate!(value)
super(value)
raise "#{name} value #{value} out of bounds for 8 bit unsigned int".lstrip if (!value.nil? && (value < 0 || value >= BLANK))
end
|