summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-05 03:57:32 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-05 03:57:32 +0000
commit4043565023531d173478c216e2a9cc6228f44a7e (patch)
tree4fed65eea80438d797c2acec1efb09bf4cb8a6b7 /ext/socket
parent0d81bbcbbc0681e9006543f40a3286a442935a80 (diff)
* ext/socket/*.c: Add proper require for example to work.
[fix GH-1378][ci skip] Patch by @schneems git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/ancdata.c2
-rw-r--r--ext/socket/basicsocket.c2
-rw-r--r--ext/socket/ipsocket.c2
-rw-r--r--ext/socket/option.c2
-rw-r--r--ext/socket/socket.c2
-rw-r--r--ext/socket/udpsocket.c2
-rw-r--r--ext/socket/unixserver.c2
-rw-r--r--ext/socket/unixsocket.c2
8 files changed, 16 insertions, 0 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 02766ba..f5451c9 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -360,6 +360,8 @@ ancillary_timestamp(VALUE self)
*
* 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>
*/
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index 2d2b22e..ee967c7 100644
--- a/ext/socket/basicsocket.c
+++ b/ext/socket/basicsocket.c
@@ -565,6 +565,8 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
*
* 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
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index 9981fd4..dbf403b 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -303,6 +303,8 @@ ip_recvfrom(int argc, VALUE *argv, VALUE sock)
*
* Lookups the IP address of _host_.
*
+ * require 'socket'
+ *
* IPSocket.getaddress("localhost") #=> "127.0.0.1"
* IPSocket.getaddress("ip6-localhost") #=> "::1"
*
diff --git a/ext/socket/option.c b/ext/socket/option.c
index 4c75fe0..bf3af17 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -272,6 +272,8 @@ sockopt_int(VALUE self)
* 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>
*
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 542cd02..14e069b 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1955,6 +1955,8 @@ Init_socket(void)
*
* 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')
*
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index 7b7b34f..c2e273c 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -19,6 +19,8 @@
* _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>
*
diff --git a/ext/socket/unixserver.c b/ext/socket/unixserver.c
index 799dcff..b1f2a38 100644
--- a/ext/socket/unixserver.c
+++ b/ext/socket/unixserver.c
@@ -17,6 +17,8 @@
*
* Creates a new UNIX server socket bound to _path_.
*
+ * require 'socket'
+ *
* serv = UNIXServer.new("/tmp/sock")
* s = serv.accept
* p s.read
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index d1cf1e2..5a44b55 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -93,6 +93,8 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
*
* Creates a new UNIX client socket connected to _path_.
*
+ * require 'socket'
+ *
* s = UNIXSocket.new("/tmp/sock")
* s.send "hello", 0
*