ruby-changes:44273
From: hsbt <ko1@a...>
Date: Wed, 5 Oct 2016 12:57:39 +0900 (JST)
Subject: [ruby-changes:44273] hsbt:r56346 (trunk): * ext/socket/*.c: Add proper require for example to work.
hsbt 2016-10-05 12:57:32 +0900 (Wed, 05 Oct 2016) New Revision: 56346 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56346 Log: * ext/socket/*.c: Add proper require for example to work. [fix GH-1378][ci skip] Patch by @schneems Modified files: trunk/ChangeLog trunk/ext/socket/ancdata.c trunk/ext/socket/basicsocket.c trunk/ext/socket/ipsocket.c trunk/ext/socket/option.c trunk/ext/socket/socket.c trunk/ext/socket/udpsocket.c trunk/ext/socket/unixserver.c trunk/ext/socket/unixsocket.c Index: ext/socket/option.c =================================================================== --- ext/socket/option.c (revision 56345) +++ ext/socket/option.c (revision 56346) @@ -272,6 +272,8 @@ sockopt_int(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/socket/option.c#L272 * Creates a new Socket::Option object which contains boolean as data. * Actually 0 or 1 as int is used. * + * require 'socket' + * * p Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true) * #=> #<Socket::Option: INET SOCKET KEEPALIVE 1> * Index: ext/socket/unixserver.c =================================================================== --- ext/socket/unixserver.c (revision 56345) +++ ext/socket/unixserver.c (revision 56346) @@ -17,6 +17,8 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/unixserver.c#L17 * * Creates a new UNIX server socket bound to _path_. * + * require 'socket' + * * serv = UNIXServer.new("/tmp/sock") * s = serv.accept * p s.read Index: ext/socket/ipsocket.c =================================================================== --- ext/socket/ipsocket.c (revision 56345) +++ ext/socket/ipsocket.c (revision 56346) @@ -303,6 +303,8 @@ ip_recvfrom(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/socket/ipsocket.c#L303 * * Lookups the IP address of _host_. * + * require 'socket' + * * IPSocket.getaddress("localhost") #=> "127.0.0.1" * IPSocket.getaddress("ip6-localhost") #=> "::1" * Index: ext/socket/socket.c =================================================================== --- ext/socket/socket.c (revision 56345) +++ ext/socket/socket.c (revision 56346) @@ -1955,6 +1955,8 @@ Init_socket(void) https://github.com/ruby/ruby/blob/trunk/ext/socket/socket.c#L1955 * * Let's create an internet socket using the IPv4 protocol in a C-like manner: * + * require 'socket' + * * s = Socket.new Socket::AF_INET, Socket::SOCK_STREAM * s.connect Socket.pack_sockaddr_in(80, 'example.com') * Index: ext/socket/basicsocket.c =================================================================== --- ext/socket/basicsocket.c (revision 56345) +++ ext/socket/basicsocket.c (revision 56346) @@ -565,6 +565,8 @@ rsock_bsock_send(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/socket/basicsocket.c#L565 * * Gets the do_not_reverse_lookup flag of _basicsocket_. * + * require 'socket' + * * BasicSocket.do_not_reverse_lookup = false * TCPSocket.open("www.ruby-lang.org", 80) {|sock| * p sock.do_not_reverse_lookup #=> false Index: ext/socket/ancdata.c =================================================================== --- ext/socket/ancdata.c (revision 56345) +++ ext/socket/ancdata.c (revision 56346) @@ -360,6 +360,8 @@ ancillary_timestamp(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L360 * * The size and endian is dependent on the host. * + * require 'socket' + * * p Socket::AncillaryData.int(:UNIX, :SOCKET, :RIGHTS, STDERR.fileno) * #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 2> */ Index: ext/socket/unixsocket.c =================================================================== --- ext/socket/unixsocket.c (revision 56345) +++ ext/socket/unixsocket.c (revision 56346) @@ -93,6 +93,8 @@ rsock_init_unixsock(VALUE sock, VALUE pa https://github.com/ruby/ruby/blob/trunk/ext/socket/unixsocket.c#L93 * * Creates a new UNIX client socket connected to _path_. * + * require 'socket' + * * s = UNIXSocket.new("/tmp/sock") * s.send "hello", 0 * Index: ext/socket/udpsocket.c =================================================================== --- ext/socket/udpsocket.c (revision 56345) +++ ext/socket/udpsocket.c (revision 56346) @@ -19,6 +19,8 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/udpsocket.c#L19 * _address_family_ should be an integer, a string or a symbol: * Socket::AF_INET, "AF_INET", :INET, etc. * + * require 'socket' + * * UDPSocket.new #=> #<UDPSocket:fd 3> * UDPSocket.new(Socket::AF_INET6) #=> #<UDPSocket:fd 4> * Index: ChangeLog =================================================================== --- ChangeLog (revision 56345) +++ ChangeLog (revision 56346) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Oct 5 12:57:21 2016 Richard Schneeman <richard.schneeman+foo@g...> + + * ext/socket/*.c: Add proper require for example to work. + [fix GH-1378][ci skip] Patch by @schneems + Wed Oct 5 11:47:19 2016 SHIBATA Hiroshi <hsbt@r...> * io.c: Fixed equivalent ruby code with core implemention. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/