[groonga-commit:3187] ranguba/activegroonga [master] make ActiveGroonga::Base.context customizable.
null+ranguba at clear-code.com
null+ranguba at clear-code.com
Fri Mar 18 01:34:17 EDT 2011
Kouhei Sutou 2011-03-18 05:34:17 +0000 (Fri, 18 Mar 2011)
New Revision: 2b76f8d66ce310a62c005c64fef4109871541148
Log:
make ActiveGroonga::Base.context customizable.
Modified files:
lib/active_groonga/base.rb
test/active-groonga-test-utils.rb
Modified: lib/active_groonga/base.rb (+3 -1)
===================================================================
--- lib/active_groonga/base.rb 2011-03-18 03:53:54 +0000 (df1862d)
+++ lib/active_groonga/base.rb 2011-03-18 05:34:17 +0000 (b0d9eeb)
@@ -33,6 +33,8 @@ module ActiveGroonga
cattr_accessor :configurations
@@context = nil
+ cattr_writer :context, :instance_writer => false
+
@@encoding = "utf8"
cattr_reader :encoding, :instance_reader => false
@@ -110,7 +112,7 @@ module ActiveGroonga
end
def context
- Groonga::Context.default
+ @@context ||= Groonga::Context.default
end
def encoding=(new_encoding)
Modified: test/active-groonga-test-utils.rb (+1 -0)
===================================================================
--- test/active-groonga-test-utils.rb 2011-03-18 03:53:54 +0000 (8302587)
+++ test/active-groonga-test-utils.rb 2011-03-18 05:34:17 +0000 (7e53678)
@@ -27,6 +27,7 @@ module ActiveGroongaTestUtils
end
def setup_sand_box
+ ActiveGroonga::Base.context = nil
Groonga::Context.default = nil
@context = Groonga::Context.default
More information about the groonga-commit
mailing list