Module: Roby::Distributed::DRobyConstant::Dump

Included in:
RelationGraph
Defined in:
lib/roby/distributed/protocol.rb

Overview

Generic implementation of the constant-dumping method. This is to be included in all kind of classes which should be dumped by their constant name (for intance RelationGraph).

Instance Method Summary collapse

Instance Method Details

#droby_dump(dest) ⇒ Object

Returns a DRobyConstant object which references self. It checks that self can actually be referenced locally by calling constant(name), or raises ArgumentError if it is not the case.



306
307
308
309
310
311
312
313
314
315
# File 'lib/roby/distributed/protocol.rb', line 306

def droby_dump(dest)
    unless DRobyConstant.valid_constants[self]
  if const_obj = (constant(name) rescue nil)
      DRobyConstant.valid_constants[self] = DRobyConstant.new(name)
  else
      raise ArgumentError, "invalid constant name #{obj.name}"
  end
    end
    DRobyConstant.valid_constants[self]
end