[#41918] [Feature #3647] Array#sample(n, replace=false) — Kenta Murata <redmine@...>

Feature #3647: Array#sample(n, replace=false)

11 messages 2010/08/03

[#41966] [Bug #3673] PTY.getpty with IO.pipe doesn't finish on FreeBSD — Yui NARUSE <redmine@...>

Bug #3673: PTY.getpty with IO.pipe doesn't finish on FreeBSD

9 messages 2010/08/10

[#41969] [Feature #3675] String#prepend, String#>> — Sora Harakami <redmine@...>

Feature #3675: String#prepend, String#>>

15 messages 2010/08/10
[#41976] Re: [Feature #3675] String#prepend, String#>> — Yukihiro Matsumoto <matz@...> 2010/08/10

まつもと ゆきひろです

[#41974] Re: [ruby-cvs:36157] Ruby:r28955 (trunk): * complex.c (nucomp_to_[ifr]): don't allow complex with in-exact — Yukihiro Matsumoto <matz@...>

まつもと ゆきひろです

7 messages 2010/08/10

[#42003] WEBrickに関するセキュリティ修正 (CVE-2010-0541) — Hideki Yamane <henrich@...>

12 messages 2010/08/11

[#42090] Math::atan2(0, 0) on ruby 1.9.2 — KUBO Takehiro <kubo@...>

久保です。

18 messages 2010/08/22
[#42092] Re: Math::atan2(0, 0) on ruby 1.9.2 — Kenta Murata <muraken@...> 2010/08/22

=1B$B$`$i$?$G$9!#=1B(B

[#42166] Ruby'sライセンスの、BSDLとのデュアルライセンスへの変更 — "NARUSE, Yui" <naruse@...>

Ruby's ライセンスは BSDL と Ruby's のデュアルライセンスになります。

14 messages 2010/08/31

[ruby-dev:42021] Re: test/unit.rb:44: warning: instance variable @init_hook not initialized

From: Kazuhiro NISHIYAMA <zn@...>
Date: 2010-08-12 14:40:51 UTC
List: ruby-dev #42021
西山和広です。

At Tue, 10 Aug 2010 21:08:54 +0900,
Tanaka Akira wrote:
> 
> 以下のようにすると、test/unit.rb:44 で警告が出るんですが、
> どうやったらうまく消せますかね。
> 
> % ./ruby -Ilib -v test/ruby/test_condition.rb
> ruby 1.9.3dev (2010-08-10 trunk 28953) [i686-linux]
> /home/ruby/tcio/ruby/lib/test/unit.rb:44: warning: instance variable
> @init_hook not initialized

ちょっとみてみただけだと、 Test::Unit::Options は
lib/test/unit.rb の最後の方の

class MiniTest::Unit
  def self.new(*)
    super
      .extend(Test::Unit::RunCount)
      .extend(Test::Unit::Options)
  end

で extend されて使われているだけで、

    module Options
      def initialize(&block)
        @init_hook = block
        super(&nil)
      end

の @init_hook に何かが設定される場合をみつけられなかったのですが、
どういう場合に設定されるのでしょうか?


extend された場合だけ特別扱いするのなら extended で
instance_variable_set すればよさそうですが。

diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index 259ff98..6d33188 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -35,6 +35,10 @@ module Test
         super(&nil)
       end
 
+      def self.extended(mod)
+        mod.instance_variable_set(:@init_hook, nil)
+      end
+
       def process_args(args = [])
         options = {}
         OptionParser.new do |opts|


-- 
|ZnZ(ゼット エヌ ゼット)
|西山和広(Kazuhiro NISHIYAMA)

In This Thread

Prev Next