Class: Roby::DRoby::V5::RemoteDRobyID
- Defined in:
- lib/roby/droby/v5/remote_droby_id.rb
Overview
Cross-instance identification of an object
Instance Attribute Summary collapse
-
#droby_id ⇒ DRobyID
readonly
The object ID.
-
#hash ⇒ Object
readonly
The ID hash value.
-
#peer_id ⇒ PeerID
readonly
The peer on which the object is known as #droby_id.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(peer_id, droby_id) ⇒ RemoteDRobyID
constructor
A new instance of RemoteDRobyID.
- #to_s ⇒ Object
Constructor Details
#initialize(peer_id, droby_id) ⇒ RemoteDRobyID
Returns a new instance of RemoteDRobyID.
24 25 26 27 28 29 |
# File 'lib/roby/droby/v5/remote_droby_id.rb', line 24 def initialize(peer_id, droby_id) @peer_id = peer_id @droby_id = droby_id @hash = [@peer_id, @droby_id].hash end |
Instance Attribute Details
#droby_id ⇒ DRobyID (readonly)
The object ID
16 17 18 |
# File 'lib/roby/droby/v5/remote_droby_id.rb', line 16 def droby_id @droby_id end |
#hash ⇒ Object (readonly)
The ID hash value
The values are immutable, so the hash value is computed once and cached here
22 23 24 |
# File 'lib/roby/droby/v5/remote_droby_id.rb', line 22 def hash @hash end |
Instance Method Details
#==(other) ⇒ Object
37 38 39 |
# File 'lib/roby/droby/v5/remote_droby_id.rb', line 37 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
31 32 33 34 35 |
# File 'lib/roby/droby/v5/remote_droby_id.rb', line 31 def eql?(other) other.kind_of?(RemoteDRobyID) && other.peer_id == peer_id && other.droby_id == droby_id end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/roby/droby/v5/remote_droby_id.rb', line 41 def to_s "#<RemoteDRobyID #{peer_id}@#{droby_id}>" end |