Module: BinData::BasePrimitive::CheckValuePlugin
- Defined in:
- lib/bindata/base_primitive.rb
Overview
Logic for the :check_value parameter
Instance Method Summary collapse
Instance Method Details
#check_value(current_value) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/bindata/base_primitive.rb', line 179 def check_value(current_value) expected = eval_parameter(:check_value, :value => current_value) if not expected raise ValidityError, "value '#{current_value}' not as expected for #{debug_name}" elsif current_value != expected and expected != true raise ValidityError, "value is '#{current_value}' but " + "expected '#{expected}' for #{debug_name}" end end |
#do_read(io) ⇒ Object
:nodoc:
174 175 176 177 |
# File 'lib/bindata/base_primitive.rb', line 174 def do_read(io) #:nodoc: super(io) check_value(snapshot) end |