[#927] UnboundMethod#to_proc — Dave Thomas <dave@...>
I'm wondering what I can do with a Proc generated by
17 messages
2003/04/06
[#929] Re: UnboundMethod#to_proc
— "Chris Pine" <nemo@...>
2003/04/06
----- Original Message -----
[#934] Re: UnboundMethod#to_proc
— Mathieu Bouchard <matju@...>
2003/04/06
[#940] Re: UnboundMethod#to_proc
— chr_news@...
2003/04/07
>
[#941] Re: UnboundMethod#to_proc
— Dave Thomas <dave@...>
2003/04/07
>> If they have diverging interfaces such that the contracts conflict
[#936] docs on implementation of ruby and/or ruby-gc ? — Ruben Vandeginste <Ruben.Vandeginste@...>
4 messages
2003/04/07
[#964] Range in logical context — Dave Thomas <dave@...>
If I run
7 messages
2003/04/16
[#965] Re: Range in logical context
— Mauricio Fern疣dez <batsman.geo@...>
2003/04/16
On Thu, Apr 17, 2003 at 06:10:40AM +0900, Dave Thomas wrote:
[#973] problem with rb_rescue2() ? — Mathieu Bouchard <matju@...>
5 messages
2003/04/19
IPAddr patch
From:
Dave Thomas <dave@...>
Date:
2003-04-23 21:21:51 UTC
List:
ruby-core #982
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