Class: Roby::Distributed::Neighbour
- Defined in:
- lib/roby/distributed/connection_space.rb
Overview
A neighbour is a [name, remote_id] tuple, where name is the name of the neighbour and remote_id the RemoteID which describes the remote ConnectionSpace, used to connect to it.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#remote_id ⇒ Object
readonly
Returns the value of attribute remote_id.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #connect ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(name, remote_id) ⇒ Neighbour
constructor
A new instance of Neighbour.
- #to_s ⇒ Object
Constructor Details
#initialize(name, remote_id) ⇒ Neighbour
Returns a new instance of Neighbour.
17 18 19 |
# File 'lib/roby/distributed/connection_space.rb', line 17 def initialize(name, remote_id) @name, @remote_id = name, remote_id end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/roby/distributed/connection_space.rb', line 16 def name @name end |
#remote_id ⇒ Object (readonly)
Returns the value of attribute remote_id.
16 17 18 |
# File 'lib/roby/distributed/connection_space.rb', line 16 def remote_id @remote_id end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 25 |
# File 'lib/roby/distributed/connection_space.rb', line 22 def ==(other) other.kind_of?(Neighbour) && (remote_id == other.remote_id) end |
#connect ⇒ Object
21 |
# File 'lib/roby/distributed/connection_space.rb', line 21 def connect; Peer.initiate_connection(ConnectionSpace.state, peer) end |
#eql?(other) ⇒ Boolean
27 |
# File 'lib/roby/distributed/connection_space.rb', line 27 def eql?(other); other == self end |
#to_s ⇒ Object
26 |
# File 'lib/roby/distributed/connection_space.rb', line 26 def to_s; "#<Neighbour:#{name} #{remote_id}>" end |