[#31927] Re: Problem with Ruby 1.8.6-p110 on DragonFly (was [PATCH] Problem with ruby 1.8.6-p36 (and p39) on Tiger) — Takahiro Kambe <taca@...>
こんばんは。
[#31928] securerandom.rb for 1.8 — Tanaka Akira <akr@...>
securerandom.rb を 1.8 に追加し、cgi/session.rb に使わせたい
At Wed, 3 Oct 2007 12:49:20 +0900,
In article <86k5pwinco.knu@iDaemons.org>,
-----BEGIN PGP SIGNED MESSAGE-----
まつもと ゆきひろです
-----BEGIN PGP SIGNED MESSAGE-----
まつもと ゆきひろです
-----BEGIN PGP SIGNED MESSAGE-----
[#31936] Rake添付 — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
-----BEGIN PGP SIGNED MESSAGE-----
まつもと ゆきひろです
Yukihiro Matsumoto さんは書きました:
-----BEGIN PGP SIGNED MESSAGE-----
NAKAMURA, Hiroshi さんは書きました:
At Wed, 10 Oct 2007 16:46:01 +0900,
-----BEGIN PGP SIGNED MESSAGE-----
[#31941] Re: [ruby-list:44071] Re: Ruby 1.8.6-p111 / 1.8.5-p114 released (Security Fix) — Shugo Maeda <shugo@...>
前田です。
-----BEGIN PGP SIGNED MESSAGE-----
前田です。
-----BEGIN PGP SIGNED MESSAGE-----
前田です。
In message <47063403.3070402@ruby-lang.org>,
In message <20071006.101915.596518898.gotoyuzo@sawara.priv.tokyo.netlab.jp>,
前田です。
In message <4709852A.1020606@ruby-lang.org>,
-----BEGIN PGP SIGNED MESSAGE-----
In message <470D9227.9090008@sarion.co.jp>,
-----BEGIN PGP SIGNED MESSAGE-----
[#31959] pcc: constant too big for cross-compiler — "NARUSE, Yui" <naruse@...>
成瀬です。
In article <470884D1.9040401@airemix.com>,
[#31980] multibyte string/regex literal with escape sequence — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
まつもと ゆきひろです
こんにちは、なかむら(う)です。
まつもと ゆきひろです
こんにちは、なかむら(う)です。
まつもと ゆきひろです
成瀬です。
こんにちは、なかむら(う)です。
In article <20071010091006.1988.USA@garbagecollect.jp>,
成瀬です。
In article <471003CB.7060701@airemix.com>,
成瀬です。
[#32049] Re: iconv enhancement in Ruby 1.9 — Nobuyoshi Nakada <nobu@...>
なかだです。
[#32133] undefined method `now' for DateTime:Class (NoMethodError) — "NAKAMURA, Hiroshi" <nakahiro@...>
-----BEGIN PGP SIGNED MESSAGE-----
どういう状況かよくわかってないのですが、いっそ必ず date 丸ごと読むようにするか、
-----BEGIN PGP SIGNED MESSAGE-----
> もしかして、単にtime.rbの「require 'parsedate'」を削ればいいだけだったり
-----BEGIN PGP SIGNED MESSAGE-----
> 確かに。で、1.9でparsedate.rbがなくなることを考えると、とりあえずtime.rb
In article <4b1598ce0710231835p1a0b3040kcc89bf0017a60c21@mail.gmail.com>,
[ruby-dev:31925] Re: ipaddr
At Sun, 30 Sep 2007 00:27:59 +0900,
Kazuhiro NISHIYAMA wrote:
> 西山和広です。
>
> ipaddrで
> IPAddr.new("127.0.0.0/8").include?("127.0.0.1")
> がfalseになって悩んだことがあるので、文字列も自動で変換して
> うけつけてくれると嬉しいのではないかと思います。
>
> # 今は
> # IPAddr.new("127.0.0.0/8").include?(IPAddr.new("127.0.0.1"))
> # じゃないとだめ。
こうするといいかな。
Index: ipaddr.rb
===================================================================
--- ipaddr.rb (revision 13588)
+++ ipaddr.rb (working copy)
@@ -105,14 +105,26 @@
return s
end
+ def coerce(other)
+ case other
+ when IPAddr
+ other
+ when String
+ self.class.new(other)
+ else
+ self.class.new(other, @family)
+ end
+ end
+ private coerce
+
# Returns a new ipaddr built by bitwise AND.
def &(other)
- return self.clone.set(@addr & other.to_i)
+ return self.clone.set(@addr & coerce(other).to_i)
end
# Returns a new ipaddr built by bitwise OR.
def |(other)
- return self.clone.set(@addr | other.to_i)
+ return self.clone.set(@addr | coerce(other).to_i)
end
# Returns a new ipaddr built by bitwise right-shift.
@@ -132,10 +144,7 @@
# Returns true if two ipaddr are equal.
def ==(other)
- if other.kind_of?(IPAddr) && @family != other.family
- return false
- end
- return (@addr == other.to_i)
+ return @family == other.family && @addr == coerce(other).to_i
end
# Returns a new ipaddr built by masking IP address with the given
@@ -153,6 +162,7 @@
# p net1.include?(IPAddr.new("192.168.2.255")) #=> true
# p net1.include?(IPAddr.new("192.168.3.0")) #=> false
def include?(other)
+ other = coerce(other)
if ipv4_mapped?
if (@mask_addr >> 32) != 0xffffffffffffffffffffffff
return false
@@ -165,17 +175,12 @@
addr = @addr
family = @family
end
- if other.kind_of?(IPAddr)
- if other.ipv4_mapped?
- other_addr = (other.to_i & IN4MASK)
- other_family = Socket::AF_INET
- else
- other_addr = other.to_i
- other_family = other.family
- end
- else # Not IPAddr - assume integer in same family as us
- other_addr = other.to_i
- other_family = family
+ if other.ipv4_mapped?
+ other_addr = (other.to_i & IN4MASK)
+ other_family = Socket::AF_INET
+ else
+ other_addr = other.to_i
+ other_family = other.family
end
if family != other_family
ついでに <=> と succ を定義して Comparable にすると、 Range を
作ったりできますね。
> # ライブラリのメンテナの話で思いだした。
梅本さんにCCしておきます。
--
/
/__ __ Akinori.org / MUSHA.org
/ ) ) ) ) / FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp
"Different eyes see different things,
Different hearts beat on different strings --
But there are times for you and me when all such things agree"