From f871e8cf0d111b7dc65f25e8c03df8e9996247ea Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 11 Feb 2009 04:29:12 +0000 Subject: [PATCH] update rdoc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/option.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ext/socket/option.c b/ext/socket/option.c index 87fecacd00..06ec5f5c80 100644 --- a/ext/socket/option.c +++ b/ext/socket/option.c @@ -34,6 +34,16 @@ optname_to_sym(int level, int optname) } } +/* + * call-seq: + * Socket::Option.new(family, level, optname, data) => sockopt + * + * Returns a new Socket::Option object. + * + * sockopt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i")) + * p sockopt #=> # + * + */ static VALUE sockopt_initialize(VALUE self, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE data) { @@ -333,6 +343,17 @@ inspect_local_peercred(int level, int optname, VALUE data, VALUE ret) } #endif + +/* + * call-seq: + * sockopt.inspect => string + * + * Returns a string which shows sockopt in human-readable form. + * + * p Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i")).inspect + * #=> "#" + * + */ static VALUE sockopt_inspect(VALUE self) { @@ -522,6 +543,16 @@ sockopt_inspect(VALUE self) return ret; } +/* + * call-seq: + * sockopt.unpack(template) => array + * + * Calls String#unpack on sockopt.data. + * + * sockopt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i")) + * p sockopt.unpack("i") #=> [1] + * p sockopt.data.unpack("i") #=> [1] + */ static VALUE sockopt_unpack(VALUE self, VALUE template) {