mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
* backport r32977 from trunk
* ext/socket: Make Socket documentation appear. Add documentation for Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert. [Ruby 1.9 - Feature #5182] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28d8d87812
commit
82322e5d4b
16 changed files with 253 additions and 103 deletions
|
@ -643,17 +643,28 @@ class Socket < BasicSocket
|
|||
|
||||
# UDP/IP address information used by Socket.udp_server_loop.
|
||||
class UDPSource
|
||||
# +remote_adress+ is an Addrinfo object.
|
||||
#
|
||||
# +local_adress+ is an Addrinfo object.
|
||||
#
|
||||
# +reply_proc+ is a Proc used to send reply back to the source.
|
||||
def initialize(remote_address, local_address, &reply_proc)
|
||||
@remote_address = remote_address
|
||||
@local_address = local_address
|
||||
@reply_proc = reply_proc
|
||||
end
|
||||
attr_reader :remote_address, :local_address
|
||||
|
||||
def inspect
|
||||
# Address of the source
|
||||
attr_reader :remote_address
|
||||
|
||||
# Local address
|
||||
attr_reader :local_address
|
||||
|
||||
def inspect # :nodoc:
|
||||
"\#<#{self.class}: #{@remote_address.inspect_sockaddr} to #{@local_address.inspect_sockaddr}>"
|
||||
end
|
||||
|
||||
# Sends the String +msg+ to the source
|
||||
def reply(msg)
|
||||
@reply_proc.call msg
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue