module BinData::BasePrimitive::AssertedValuePlugin
Logic for the :asserted_value parameter
Public Instance Methods
_value()
click to toggle source
# File lib/bindata/base_primitive.rb, line 198 def _value reading? ? @value : eval_parameter(:asserted_value) end
assert!()
click to toggle source
# File lib/bindata/base_primitive.rb, line 207 def assert! assert_value(snapshot) end
assert_value(current_value)
click to toggle source
# File lib/bindata/base_primitive.rb, line 211 def assert_value(current_value) expected = eval_parameter(:asserted_value, :value => current_value) if current_value != expected raise ValidityError, "value is '#{current_value}' but " + "expected '#{expected}' for #{debug_name}" end end
assign(val)
click to toggle source
Calls superclass method
# File lib/bindata/base_primitive.rb, line 193 def assign(val) assert_value(val) super(val) end