diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-19 00:07:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-19 00:07:25 +0000 |
commit | d371e3583e3b1e0692f92343017b62d2628190ff (patch) | |
tree | be82924ada754f8542f394d0a3d28e0a0b02a098 /lib/ipaddr.rb | |
parent | 1fae66fca28167ca0e25625091c5df49405b8023 (diff) |
* lib: revert r31635-r31638 and untabify with expand(1).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/ipaddr.rb')
-rw-r--r-- | lib/ipaddr.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb index 87646b95ac..317f5c9458 100644 --- a/lib/ipaddr.rb +++ b/lib/ipaddr.rb @@ -72,17 +72,17 @@ end # # ipaddr1 = IPAddr.new "3ffe:505:2::1" # -# p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff> +# p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff> # -# p ipaddr1.to_s #=> "3ffe:505:2::1" +# p ipaddr1.to_s #=> "3ffe:505:2::1" # # ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000> # -# p ipaddr2.to_s #=> "3ffe:505:2::" +# p ipaddr2.to_s #=> "3ffe:505:2::" # # ipaddr3 = IPAddr.new "192.168.2.0/24" # -# p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0> +# p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0> class IPAddr @@ -157,8 +157,8 @@ class IPAddr # net1 = IPAddr.new("192.168.2.0/24") # net2 = IPAddr.new("192.168.2.100") # net3 = IPAddr.new("192.168.3.0") - # p net1.include?(net2) #=> true - # p net1.include?(net3) #=> false + # p net1.include?(net2) #=> true + # p net1.include?(net3) #=> false def include?(other) other = coerce_other(other) if ipv4_mapped? @@ -473,9 +473,9 @@ class IPAddr end # It seems AI_NUMERICHOST doesn't do the job. #Socket.getaddrinfo(left, nil, Socket::AF_INET6, Socket::SOCK_STREAM, nil, - # Socket::AI_NUMERICHOST) + # Socket::AI_NUMERICHOST) begin - IPSocket.getaddress(prefix) # test if address is valid + IPSocket.getaddress(prefix) # test if address is valid rescue raise ArgumentError, "invalid address" end @@ -514,8 +514,8 @@ class IPAddr def in_addr(addr) if addr =~ /^\d+\.\d+\.\d+\.\d+$/ return addr.split('.').inject(0) { |i, s| - i << 8 | s.to_i - } + i << 8 | s.to_i + } end return nil end |