Show
Ignore:
Timestamp:
10/04/07 11:33:51 (6 years ago)
Author:
cho45
Message:

lang/ruby/module-pluggable/test/plugins/test.rb,
lang/ruby/module-pluggable/test/test_module-pluggable.rb,
lang/ruby/module-pluggable/lib/module/pluggable.rb:

プラグインのインスタンス変数に常に Plugins インスタンスをセットするように

Location:
lang/ruby/module-pluggable
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/module-pluggable/lib/module/pluggable.rb

    r357 r358  
    6262 
    6363                        @plugins[klass_name][:instance].on_load rescue NameError 
     64                        @plugins[klass_name][:instance].instance_variable_set(:@plugins, self) 
    6465                         
    6566                        klass_name 
  • lang/ruby/module-pluggable/test/plugins/test.rb

    r355 r358  
    66 
    77        def foobar 
     8                @plugins 
    89        end 
    910end 
  • lang/ruby/module-pluggable/test/test_module-pluggable.rb

    r357 r358  
    1919        def test_classname_conversion 
    2020                m = Module::Pluggable::Plugins.new({:search_path => @plugins_dir}) 
    21                 assert_equal "foo_bar", m.__send__(:klass2file, "FooBar") 
    22                 assert_equal "FooBar", m.__send__(:file2klass, "foo_bar") 
     21                assert_equal "foo_bar",     m.__send__(:klass2file, "FooBar") 
     22                assert_equal "FooBar",      m.__send__(:file2klass, "foo_bar") 
    2323                assert_equal "foo/foo_bar", m.__send__(:klass2file, "Foo::FooBar") 
    2424                assert_equal "Foo::FooBar", m.__send__(:file2klass, "foo/foo_bar") 
     
    3636                test.plugins.call(:instance_variable_set, :@test_obj, obj) 
    3737                assert_equal obj, test.plugins["Test"].instance_variable_get(:@test_obj) 
     38                assert_equal test.plugins, test.plugins["Test"].foobar 
    3839 
    3940                assert_equal "This is test plugin.", test.plugins.description["Test"]