Class: Tox::Friend
- Inherits:
-
Object
- Object
- Tox::Friend
- Defined in:
- lib/tox/friend.rb
Overview
Friend representation in Tox client.
Defined Under Namespace
Classes: NotConnectedError, NotFoundError
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #exist! ⇒ Object (also: #exists!)
-
#initialize(client, number) ⇒ Friend
constructor
A new instance of Friend.
Constructor Details
#initialize(client, number) ⇒ Friend
Returns a new instance of Friend.
10 11 12 13 |
# File 'lib/tox/friend.rb', line 10 def initialize(client, number) self.client = client self.number = number end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
8 9 10 |
# File 'lib/tox/friend.rb', line 8 def client @client end |
#number ⇒ Object
Returns the value of attribute number.
8 9 10 |
# File 'lib/tox/friend.rb', line 8 def number @number end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 25 26 |
# File 'lib/tox/friend.rb', line 22 def ==(other) return false unless self.class == other.class client == other.client && number == other.number end |
#exist! ⇒ Object Also known as: exists!
15 16 17 18 |
# File 'lib/tox/friend.rb', line 15 def exist! raise NotFoundError, "friend #{number} not found" unless exist? self end |