From e2c017a8ceb84a95da28fe54b51afb6e58a0d8f9 Mon Sep 17 00:00:00 2001 From: drbrain Date: Fri, 4 Aug 2006 20:39:28 +0000 Subject: [PATCH] Move Example so RDoc picks it up. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/ipaddr.rb | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb index 9e2717b7c3..cb15fb50dd 100644 --- a/lib/ipaddr.rb +++ b/lib/ipaddr.rb @@ -7,29 +7,9 @@ # You can redistribute and/or modify it under the same terms as Ruby. # # $Id$ -#-- +# # TODO: # - scope_id support -#++ -# -#== Example -# -# require 'ipaddr' -# -# ipaddr1 = IPAddr.new "3ffe:505:2::1" -# -# p ipaddr1 #=> # -# -# p ipaddr1.to_s #=> "3ffe:505:2::1" -# -# ipaddr2 = ipaddr1.mask(48) #=> # -# -# p ipaddr2.to_s #=> "3ffe:505:2::" -# -# ipaddr3 = IPAddr.new "192.168.2.0/24" -# -# p ipaddr3 #=> # - require 'socket' unless Socket.const_defined? "AF_INET6" @@ -75,8 +55,27 @@ unless Socket.const_defined? "AF_INET6" end end -# IPAddr provides a set of methods to manipulate an IP address. Both -# IPv4 and IPv6 are supported. +# IPAddr provides a set of methods to manipulate an IP address. Both IPv4 and +# IPv6 are supported. +# +# == Example +# +# require 'ipaddr' +# +# ipaddr1 = IPAddr.new "3ffe:505:2::1" +# +# p ipaddr1 #=> # +# +# p ipaddr1.to_s #=> "3ffe:505:2::1" +# +# ipaddr2 = ipaddr1.mask(48) #=> # +# +# p ipaddr2.to_s #=> "3ffe:505:2::" +# +# ipaddr3 = IPAddr.new "192.168.2.0/24" +# +# p ipaddr3 #=> # + class IPAddr IN4MASK = 0xffffffff