< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
It looks like I can't commit patches to /src/ruby, so I'm posting them
here: could some kind person apply them please?
Cheers
Dave
Index: ChangeLog
===================================================================
RCS file: /src/ruby/ChangeLog,v
retrieving revision 1.1664
diff -u -r1.1664 ChangeLog
--- ChangeLog 23 Apr 2003 06:31:27 -0000 1.1664
+++ ChangeLog 23 Apr 2003 14:26:11 -0000
@@ -1,3 +1,7 @@
+Wed Apr 23 14:05:1r40 2003 Dave Thomas <dave / pragprog.com>
+
+ * lib/ipaddr.rb (include?): Support non-IPAddr parameters
+
Wed Apr 23 13:31:10 2003 Yukihiro Matsumoto <matz / ruby-lang.org>
* lib/cgi.rb (CGI::QueryExtension::[]): always return Value
Index: lib/ipaddr.rb
===================================================================
RCS file: /src/ruby/lib/ipaddr.rb,v
retrieving revision 1.1
diff -u -r1.1 ipaddr.rb
--- lib/ipaddr.rb 23 Dec 2002 17:07:49 -0000 1.1
+++ lib/ipaddr.rb 23 Apr 2003 14:26:14 -0000
@@ -131,9 +131,13 @@
other_addr = other.to_i
other_family = other.family
end
- if family != other_family
- return false
- end
+ else # Not IPAddr - assume integer in same family as us
+ other_addr = other.to_i
+ other_family = family
+ end
+
+ if family != other_family
+ return false
end
return ((addr & mask_addr) == (other_addr & mask_addr))
end
@@ -685,6 +689,14 @@
assert_equal(true, net1.include?(IPAddr.new("192.168.2.0")))
assert_equal(true, net1.include?(IPAddr.new("192.168.2.255")))
assert_equal(false, net1.include?(IPAddr.new("192.168.3.0")))
+ # test with integer parameter
+ int = (192 << 24) + (168 << 16) + (2 << 8) + 13
+printf "%x\n", int
+printf "%x\n", net1.to_i
+
+ assert_equal(true, net1.include?(int))
+ assert_equal(false, net1.include?(int+255))
+
end
end