diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-11 04:29:12 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-11 04:29:12 +0000 |
commit | f871e8cf0d111b7dc65f25e8c03df8e9996247ea (patch) | |
tree | 06656aba040a35665b89b904c7e358e8245df203 /ext/socket | |
parent | a8de15e0b56056b0ba5d4d7f724f38ea8d97d888 (diff) | |
download | ruby-f871e8cf0d111b7dc65f25e8c03df8e9996247ea.tar.gz |
update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/option.c | 31 |
1 files changed, 31 insertions, 0 deletions
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 #=> #<Socket::Option: INET SOCKET KEEPALIVE 1> + * + */ 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 + * #=> "#<Socket::Option: INET SOCKET KEEPALIVE 1>" + * + */ 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) { |