Class: Plug::Peer
Instance Attribute Summary collapse
-
#addr ⇒ Object
readonly
Returns the value of attribute addr.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#mute ⇒ Object
Returns the value of attribute mute.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#transport ⇒ Object
readonly
Returns the value of attribute transport.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(addr, owner) ⇒ Peer
constructor
A new instance of Peer.
- #say(dat, sender) ⇒ Object
Constructor Details
#initialize(addr, owner) ⇒ Peer
Returns a new instance of Peer.
13 14 15 16 17 18 19 20 |
# File 'lib/rbkb/plug/peer.rb', line 13 def initialize(addr, owner) @addr = addr @owner = owner @transport = @owner.transport @port, @host = Socket.unpack_sockaddr_in(@addr) @name = "PEER-#{@host}:#{@port}(#{@transport})" end |
Instance Attribute Details
#addr ⇒ Object (readonly)
Returns the value of attribute addr.
10 11 12 |
# File 'lib/rbkb/plug/peer.rb', line 10 def addr @addr end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
10 11 12 |
# File 'lib/rbkb/plug/peer.rb', line 10 def host @host end |
#mute ⇒ Object
Returns the value of attribute mute.
11 12 13 |
# File 'lib/rbkb/plug/peer.rb', line 11 def mute @mute end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/rbkb/plug/peer.rb', line 10 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
10 11 12 |
# File 'lib/rbkb/plug/peer.rb', line 10 def owner @owner end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
10 11 12 |
# File 'lib/rbkb/plug/peer.rb', line 10 def port @port end |
#transport ⇒ Object (readonly)
Returns the value of attribute transport.
10 11 12 |
# File 'lib/rbkb/plug/peer.rb', line 10 def transport @transport end |
Instance Method Details
#close ⇒ Object
32 33 34 |
# File 'lib/rbkb/plug/peer.rb', line 32 def close @owner.unbind unless @transport == :UDP end |