Class: Roby::DRoby::V5::DRobyClass
- Defined in:
- lib/roby/droby/v5/droby_class.rb
Overview
Dumps a class and its ancestry
Use ClassDumper to add the corresponding standard droby_dump method
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The class name.
-
#remote_siblings ⇒ Object
readonly
The known siblings for this class.
-
#superclass ⇒ Object
readonly
The class superclass.
Instance Method Summary collapse
-
#initialize(name, remote_siblings, superclass) ⇒ DRobyClass
constructor
Initialize a DRobyModel object with the given set of ancestors.
-
#proxy(peer) ⇒ Object
Returns a local Class object to match this class.
Constructor Details
#initialize(name, remote_siblings, superclass) ⇒ DRobyClass
Initialize a DRobyModel object with the given set of ancestors
18 19 20 21 22 |
# File 'lib/roby/droby/v5/droby_class.rb', line 18 def initialize(name, remote_siblings, superclass) @name = name @remote_siblings = remote_siblings @superclass = superclass end |
Instance Attribute Details
#name ⇒ Object (readonly)
The class name
11 12 13 |
# File 'lib/roby/droby/v5/droby_class.rb', line 11 def name @name end |
#remote_siblings ⇒ Object (readonly)
The known siblings for this class
13 14 15 |
# File 'lib/roby/droby/v5/droby_class.rb', line 13 def remote_siblings @remote_siblings end |
#superclass ⇒ Object (readonly)
The class superclass
15 16 17 |
# File 'lib/roby/droby/v5/droby_class.rb', line 15 def superclass @superclass end |
Instance Method Details
#proxy(peer) ⇒ Object
Returns a local Class object to match this class
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/roby/droby/v5/droby_class.rb', line 25 def proxy(peer) # We have to manually call find_local_model here as it # resolves classes by name as well as by ID if m = peer.find_local_model(self) m elsif !superclass # this class was supposed to be present raise NoLocalObject, "cannot find local class #{name} as expected by the protocol" else name = self.name local_class = Class.new(peer.local_model(superclass)) if name local_class.singleton_class.class_eval do define_method(:name) { name } end end peer.register_model(local_class, remote_siblings) local_class end end |