Method: PEROBS::ObjectBase#_check_assignment_value

Defined in:
lib/perobs/ObjectBase.rb

#_check_assignment_value(val) ⇒ Object



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/perobs/ObjectBase.rb', line 221

def _check_assignment_value(val)
  if val.respond_to?(:is_poxreference?)
    # References to other PEROBS::Objects must be handled somewhat
    # special.
    if @store != val.store
      PEROBS.log.fatal 'The referenced object is not part of this store'
    end
  elsif val.is_a?(ObjectBase)
    PEROBS.log.fatal 'A PEROBS::ObjectBase object escaped! ' +
      'Have you used self() instead of myself() to get the reference ' +
      'of the PEROBS object that you are trying to assign here?'
  elsif !NATIVE_CLASSES.include?(val.class)
    PEROBS.log.fatal "Assigning objects of class #{val.class} is not " +
      "supported. Only PEROBS objects or one of the following classes " +
      "are supported: #{NATIVE_CLASSES.join(', ')}"
  end
end